Tikfollowers

How to change color of gameobject in unity. Play the game and the cube should change color to black.

You can set the colour using Material#color - for example, this. And thank you for taking the time to help us improve the quality of Unity Documentation. Jun 21, 2014 · A game object doesn't have a graphical representation by default. On July 12, the Unity Forums will become read-only. var objecttochangecolor : GameObject; // or transfom; And just add it directly to it. 5f,1,1); //C# renderer. red); magique October 28, 2015, 12:52pm 3. If you prefer written ins Sep 5, 2015 · If you really want to use transparency, you can do this gameObject. 5 seconds. Posts: 10. Adding Color Transitions: You can add color transitions to the object by using Dec 20, 2011 · 194. In the color picker, you note that “Perfect Grey” is “ADADAD” and the Alpha is 200. First, you have to get a reference to your material. The gameobject’s starting position is (0,-9,0). Use the [MainColor] ShaderLab Properties attribute to make Unity consider a color with a different property name to be the main color. red); But this script changes White color: May 13, 2022 · 1. enabled = false; If you really want to use transparency, you can do this gameObject. The proper way to change a color would be this void OnTriggerStay Sep 27, 2012 · Make an empty GameObject, position it where you want your pivot to be, then make your original object a child of the empty GameObject. Confusingly, if it’s set to all white, the sprite is its normal colour, while all black will make the sprite black. @millanow, You need to call the following before setting the _EmissionColor. May 13, 2015 · I've also found that if I want to use Color method the range of variables should be from 0 to 1, so I changed it even to the following code: Code (CSharp): _spriteRender = gameObject. you could add a reference to the object like. color = Color. com#unity #gamedev #unitytutorial #unity3d #uni Jun 14, 2021 · In order to change every material on the object, you need to replace the whole . red; } This is C# and 'off the top of my head' without testing, but it may get you moving in a direction. collider. Array Decay in C++ ». The other button, Local/Global, shows the gizmo aligned to the world axes (Global) or to the actual object orientation (Local). // Update is called once per frame. It comes back with a null reference on this line : hit. Rendering color for the Sprite graphic. Copy and paste the code below to the script. Apr 21, 2017 · On line 15 after finding the Renderer that you called “r”, you try and gain access to a member of Ar_Obj_Tag which is a GameObject which doesn’t have a definition for a variable called “r”. sharedMaterial. a - 0. You can also add the component to an existing GameObject via the Components A functional part of a GameObject. GetChild(0). Create and add a script called ColorChange to the cube. Collections. 01f); renderer. [ClientRpc] public void RpcUpdateFlagColor() In the Unity menu bar, go to GameObject > Effects > Trail. When you create a Sprite ( GameObject > 2D Object > Sprite ), Unity automatically creates a GameObject with the Sprite Renderer component attached. In your game, the myGameObject’s color gets changed to Red for whatever reason, but later, your GameObject is newly invigorated and its color must change back to “Perfect grey”. GetComponent< SpriteRenderer >(); _spriteRender. y; Jan 15, 2018 · Because Color is a struct (value type), not a class (reference type), changing your private color enemyMesh won't change the color of the material. This means for example, if the GameObject was previously next to its parent, setting worldPositionStays to false will move the GameObject to be positioned next to To change the colour of the Selection Wire, go to Edit > Preferences (macOS: Unity > Settings) in the main menu, select Colors, and alter the Selected Wireframe setting. renderer doesn't have. Nov 3, 2016 · Some are even free! You didn’t specified if you wanted to make a different game or just change the objects like: Press “W” to change from sphere to monkey, so i assume that you are talking about a style changing. 6f); Note: If the Color Constructor is called and no r,g,b,a components are given, all r,g,b,a components default to a value of 0. color = new Color(1f, 1f, 1f, 0. FindGameObjectsWithTag ("objecttochange"); Both ways work. Collections namespace. //Attach this script to a GameObject with a Renderer (go to Create > 3D Object and select one of the first 6 options to create a GameObject with a Renderer automatically attached). I need to change Blue to red in script. renderers = gameObject. materials array. • We use a boolean called "fading" to block input while we are transitioning. GetComponentsInChildren (typeof (Renderer)); Then, when you want to change the colors: foreach (Renderer renderer in renderers) {. **material**. Click the Environment tab. How can I change the color of my object? private Transform myTransform; private void changeColor() {. check whether the print is working or not. 0f, 1. Alpha 1. } Shaders that use lighting - for shaders that react to light, the intensity and color of the light will impact the color. Hi, as it says I'm not sure how I should change the tint of a GameObject without changing it for all other GameObjects using the same material. However, there is likely a better way to do what you are trying to do. Code (csharp): GetComponent < Renderer >(). If you have any question, don’t hesitate in asking it. yellow; To. Oct 27, 2013 · mat. Jan 20, 2022 · Let's take a look at the docs: The instance ID of an object is always unique. Feb 19, 2023 · Here are a few ways you can enhance and optimize the script for changing object color on mouse click: Adding Multiple Colors: You can add multiple colors to the object by using an array of colors and a counter variable to cycle through the colors on each mouse click. void Start () {. RGBA is (1, 0, 0, 1). Modified it a little bit to do just this. color. As such, the ID is not reliable for performing actions between the Editor and runtime sessions, for example, loading an object state from a save file. //Attach this script to a GameObject to have it output messages when your mouse hovers over it. When I press space it swaps between purple and blue instead of red and blue, any help would be appreciated! Code (CSharp): using System. One of which will have your underlying square color, and the second one could have the grid square with a transparent center. Renderer myRenderer = GetComponent<Renderer>(); Color newColor = new Color(red,green,blue); myRenderer. color = ballColors [(int) type]; Jan 4, 2019 · You can get the Renderer component of a GameObject and then change the alpha of the color gradually in Update(). using UnityEngine; public class ColorChange : MonoBehaviour. a = 0; Although if you are setting transparency, you need to make sure the shader the material is using supports transparency. go_highlight. RGBA is (0, 1, 0, 1). This section provides information on customizing the following: Show and hide grid lines; Change the axis where the grid appears; Resize the grid; Change the default color of the grid lines; Change the opacity Jan 28, 2013 · Set the color/textures required by the shader; A simple shader like Diffuse (the default) will take a color and a texture - more advanced shaders may have many colors and many textures. Sep 21, 2014 · To change the color of the whole object, the color must be changed of the individual materials in the materials array: for (var i = 0; i < renderer. transform. Description. SpriteRenderer. To change the color when I change the type in the inspector I wrote this method: Code (CSharp): private void OnValidate () {. Add a 3D object>Cube to the scene. OP may use MaterialBlock to prevent creating new instances but it breaks Jan 20, 2015 · To do that, find the “Create” drop-down in the Project pane, and click Create/material. May 14, 2017 · It’s like trying to change the position. Here is an Example Code. Cube); I then change it's color as such; Code (CSharp): Renderer r = arrowGetComponent < Renderer >(); r. See Selection Outline and Selection Wire, below, for images and . color = newCol; } Dec 25, 2016 · Just use Color32 class to get the r, b, g, a of your desired gameobject. Apr 19, 2011 · Hi! If you still need help with this I may be a little help. Highlight it and press enter. i am stuck at one point where i planned to show color comparisons by using a screen slide kind of dragger which drags over the car in which the right side of car will be in one color say red and the left side would be in blue Sep 7, 2021 · Color. 0 = transparent. Code (CSharp): arrow = GameObject. PraetorBlue said:↑. To keep track of whether it's faded or not, we use a boolean named "faded". Via code you can change a color of a single object by doing: renderer. If you have any questions or comments, feel free to leave them in the comments section below. color = new Color ( 0f, 0f, 1f,1f); Still it doesn't work. color = new Color(0. Material childMat = GetComponentInChildren < Renderer >(). Select the Trail Renderer GameObject, and parent it to the GameObject that you want it to generate a trail for. The final result should position some buttons inside a parent panel element (one at top left, top right, center left, center right, bottom left, bottom right). Here is some code I wrote. Feb 7, 2023 · Let’s try to set the color of the default cube in Unity. There are different ways you can go about Dec 4, 2019 · In line 16, 22, 30 and 35 above, do not set the color of the material. Constructs a new Color with given r,g,b components and sets a to 1. Apr 19, 2007 · Set it up in the editor under Edit>Project Settings>Input and make sure its name matches the one you set in the inspector. Then select “red” and in the inspector window you’ll see that your new material will have a Diffuse shader. SetColor("_Color", Color. Feb 16, 2016 · For solving this issue, you have to calculate the percentage value for R = 200. Find without assigning the return value. In On Click () Select Object > Scene > Button. Code (csharp): Color cubecol; // change this with your colorpicker. Here I used a cube gameobject and got the color of its material. green; This does not require you to import the System. color = new Color(0, 255, 0); answered Aug 1, 2019 at 8:50. {. Colors values are between 0 and 1 (as floats) – SagiZiv. youtube. For some reason your suggested change could not be submitted. But I want to make it multiplayer now, and I am having lots of trouble figuring out how to send the changes over the network so all players can see a single player’s color change. Feb 19, 2019 · Now if you click on “Color”, you can manually change the sprites transparency in the colour changer by turning alpha down to 0, or tint the sprite by modifying how much red, blue and green is in the image. com/watch?v=USBIGzkFI-Q Code Editor: VS Code Keep in touchcodecyber@protonmail. You will need to set the color of the material via its Renderer component. This is how it would look with only half the opacity. Solid green. Oct 1, 2021 · You need to use GetComponent<MeshRenderer>(). GetComponent(). After running, by clicking on the button, the color of the mug should change to the selected color. Accessing the materials of a renderer through those properties is discouraged, because whenever you do that, you are creating a completely new material in memory. You will have to create a temporary color, assign the material's color to that temporary color, adjust the temporary color, and reassign the temporary color to the material's color. 0f, 0. //if you want you can check tag of that gameobject. counter ++; print (“counter”+counter); Note: to work collision your object should have rigidbody. Or as you said have it tag and find it whit. color = new Color32(255, 0, 0, 255);. blue;} You have to find the button with you want to work with, so instead of “Button1” put the name of your button After that, you have to assign the void to the button Jun 27, 2015 · I want to change the color of a image in my scene with a script and it gives me this error. By default, Unity considers a color with the property name name "_Color" to be the main color. Such as mesh renderer, particle system, image (UI) Depending of what component you are talking about the answer to both questions (making it half transparent / cursor over object detection) would be different. • The script only uses one button. Solid red. rbatelaan2 July 21, 2020, Nov 8, 2020 · In this Unity game development tutorial we're going to look at how we can write a script to change the Albedo colour of a material. SetColor("_EmissionColor", Color. In Unity 5, the best way (TO MAKE AN OBJECT INVISIBLE) that worked for me was to: Set all of the game object's materials you want to be invisible to transparent under the rendering mode. color = color; If you case of them being a 3D objects you will need to change SetColor to work with Renderer and adjust the material value. Dec 20, 2011 · Dec 20, 2011. Give the new material a name, say “red”. Collections; Mar 29, 2015 · legacy-topics. Nov 14, 2023 · In this video we see how to change the color of a material in Unity through script, in this case we are going to create a script, define a Material type vari Dec 31, 2012 · You probably have the Center/Pivot button (see below) in the Editor set to Center, which shows the object gizmo at its geometric center - click it to change to the Pivot mode, and the gizmo will appear at the object pivot. red; // renderer doesn't have *material*. Worse, it requires code changes to change how anything works! Description. // Use this for initialization. Mar 30, 2020 · I have a Prefab "Cube" which is a simple cube with a Script which has a "Type" property (which is just an enum). green; with . This can be done with the Time. 1,253 1 14 31. To allow this change. Hello I currently have a script to change the color of an item in unity, I want it to swap between Blue and Red starting with Blue which the material color is already blue in unity to start. var objecttochangecolor : GameObject; var objecttochangecolor = GameObject. white; You have to either define a color, or you can use Color. Please <a>try again</a> in a few minutes. I'm only trying to be helpful. green; } The final change I made was to use the predefined colors red and green. materials to get all materials of your MeshRenderer in an array. Neither line in the code -> Flag. The second material in the MeshRenderer will be drawn on top of the first. I would suggest using the Legacy Shaders/Transparent Diffuse shader. The selected vertex color becomes the rendering color, and is accessible in a pixel shader. This option is only available in the Scene view Gizmos menu; you cannot enable it in the Game view Gizmos menu. Jul 21, 2020 · Unity Discussions How do I change the color of a gameobject based on number of collisions? Questions & Answers. Similar to Rotate GameObject over time and Move GameObject over time questions. EnableKeyword (“_EMISSION”); I had the same issue To set it to inactive from a script attached to this same gameObject, you can do this gameObject. Also the type Color is a struct and so you can’t directly modify Color. The alpha of a material is within the color property. I want to change its color from green to red during the 1. x; ypos = Input. materials. Nov 20, 2020 · On this image you can see whole the object. g, oldCol. //If your mouse hovers over the GameObject with the script attached, output this message. color = colorToTurnTo; I expected the GameObject to turn white when I started the game, but I couldn't start the game due to the errors. color = Color(0. If you want to change all the color of objects using that material, use Renderer. I made a simple 3D game where you go around and change the colors of objects. red; } Javascript: for (var i = 0; i < renderer. For example, if the Scale value is 2, the selected GameObject will scale at an increment of twice its original size. It will be moving up to the position (0,-6,0) over a period of 1. a = 0; Although if you are setting transparency, you need to make sure the shader the In this short video I show a simple way how to change color of 3D object in Unity game. material; childMat. Right now I have a fairly standard counter that increases by a point every shot This makes the fog blend to the color of the Scene sky. Jun 9, 2014 · We are migrating the Unity Forums to Unity Discussions. 2. Am I just blind? The game object's inspector. The fourth color changes the opacity of your object. gameObject. This function automatically instantiates the materials and makes them unique to this Jan 29, 2018 · Posts: 6. How I can use: Jan 8, 2018 · red = false; blue = true; counter = 0; NO need of update there. GetComponent). Gray_Rhino. Change the foreach to: Mar 24, 2017 · ezjm427. gameObject. As soon as you have calculated the percentage amount from 200 of the max value 255, which is around 78%, you can set the new color with the following line of code: gameObject. Become Family shorturl. materials[1]. Now run the program. UI; public class PlayerMaterialSwaper : MonoBehaviour { public Material Material1; //in the editor this is what you would set as the object you wan't to change public GameObject Object; void Description. void OnMouseOver() {. Suppose you instantiate a GameObject, you can assign (change) the color by simply accessing render and material: gameObject. Hope it helps you! using System. Mar 22, 2023 · private void Start() SetColor(wall, Color. Anything between those = translucent. You can’t yield between changing one material and changing it Oct 5, 2017 · 7. //This script changes the Color of your GameObject ’s Material when your mouse hovers over it in Play Mode. Submission failed. material= color1; Aug 8, 2019 · In this In-Editor Tutorial, you will learn how to in Unity change object colors. Change the material color of an Object in Unity 3D. I am trying to change the color of a primitive cube, created. So if you want to modify the second material, you need to modify the index 1 of the materials array like that : rayHit. void onMouseDown () {. using UnityEngine; public class OnMouseOverExample : MonoBehaviour. red : Color. Aug 2, 2015 · I changed the emission color with this code: Material mymat = GetComponent<Renderer>(). com during this transition time. The Canvas' inspector. In the Other Settings section, enable the Fog checkbox. And the updated code: Feb 7, 2024 · 12- Select the GameObject from the Inspector tab and select a desired color through My Color and then press the play button. Everything but the color shift seems be working fine. red;*. The main color of the Material. I have a gameObject and want to change its color from Green to red and change it back from red to green. Play the game and the cube should change color to black. oStaiko November 3, 2016, 9:57pm 2. To do this: From the menu bar, click Window > Rendering > Lighting Settings. You're looking up a component on the (current) game object, instead of the one in the list (or the found that you presumably tried to find in the previous line), and also you're switching on a list (index) but not using that result. 5f); If you’re setting the translucency of a larger amount of objects, it may prove beneficial to share materials between Jun 18, 2022 · In this video, we are going to see how to change the color of a Gameobject during runtime using script. color = new Color32 Set the parent of the transform. This method is the same as the parent property except that it also lets the Transform keep its local orientation rather than its global orientation. You need to add certain components to make it visible. May 30, 2017 · 4. Instead, set the actual material to either color1 or color2, your public inspector variables that you appear not to be using. May 6, 2021 · In short, to change a text by clicking the button you need: 1) Create a GameObject with a Text component; 2) Create a GameObject with a Button component; 3) Create a GameObject with a component of your custom script; 4) Create the reference in your custom script on the Text component you want to update; 5) Create a public method in your custom Nov 22, 2018 · It totally depends on what OP is doing because if you have many objects/prefabs referencing one material, Renderer. Did you find this page useful? Jan 13, 2019 · Generally with Unity we don't instantiate a primitive and add components to it by hand, doing so is generally not the best way of doing things long term, as it's hard to non-programmers to change the functionality. I thought I would be ambitious and try to make the color not only change with every new cube, but also shift to a new color before it randomizes again. 3f, 0. GetComponent<Renderer> (). Having the alpha of a color be of any use at all however would depend on the material's shader you May 14, 2019 · when moused over obj changes to material (2) material (2) is blue. color = flagColor; changes the color of the flag to yellow. Renderer has material, but Component. white); SetColor(wallShort, Color. 5,1,1); //JS In this video i teach you how to change the color of a gameobject in Unity. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. 4f, 0. length; i++) {. Mar 19, 2019 · private int index = 1; //initialize at 1, otherwise you have to press the ball twice to change color. Jan 4, 2011 · In Start () Cache the renderers. If you ever would like to change the colors to a color Unity does not predefined, you can change the code back to creating a new Color struct. Function > ChangeColor > ChangeMaterial () . range () accordingly on that array in the Start method (or a custom method if you restart manually. at/qCP23SONG/ARTIST NOBODY Oct 8, 2015 · In old versions of Unity Component's renderer had material, now UnityEngine. I would advise creating the Color at compile time or as a SerializedField to define it in the inspector. //This example outputs Sliders that control the red green and blue elements of a sprite's color //Attach this to a GameObject and attach a Now go to the Inspector window, select Button > On Click () > +. In it has child "default" with 3 materials. R, G, & B in this function are floats Jan 11, 2021 · The goal is to create a cube that changes size, color, location, and rotation every 5 seconds or manually with Space. ) If every color should be guaranteed unique, use the singleton pattern to keep a common instance of that colors list and remove the used color every time it's taken. The default color is white when no color is selected. enemyMesh = GetComponent<SkinnedMeshRenderer> (). material; mymat. Either you use a public variable public Material yourMaterial; on your component and use drag-and-drop the material in the interface, or you can get it by code like this : Feb 7, 2015 · 1. I'm making an block-like game and now I want to implement highlighting block (gameobject) while there is mouseOver that specific block. mousePosition. Collections; using System. color = new Color (0, 1, 0, 1); This works fine in the unity editor however when I deploy the app to Jul 6, 2016 · Lets say you’ve come up with the perfect shade of grey (or gray). More info See in Glossary and the Hierarchy window. } If you want to return the original colors, you have to first change ALL the colors, then yield, then after returning change back ALL the colors. Then, click on the small round button next to albedo and scroll down on the list of items given until you find one called UIMask. color; makes a copy of the color of the material. highlightedColor= Color. color = new Color(1. renderer. A complete new entity. deltaTime and Vector3. white ('white' can be any of a number of colors, including white, red, yellow, black, gray, blue, cyan, green, etc. How can I fix this? image. myTransform. keshk March 29, 2015, 4:25pm 1. ) Or build your own Color using Color (R, G, B). I’m using Unity5. I tried to make this using: ramps[stageCount]. This is the same as calling GetColor or SetColor with the property name of the main Jul 23, 2015 · gameObject. unity. legacy-topics. Nov 4, 2011 · if you just want to change the color of the next created cubes you could also store it and assign it to the cubes you create next. Apr 1, 2017 · For instance, you're calling a GameObject. material = material (2); This is a simplified solution, to match your code however there are more effective ways of achieving this. Nov 1, 2015 · Hello! I’m working on and learning some basics of Unity 5, UNET, and networking. A GameObject can contain any number of components. You will learn two ways to change color in Unity. Customize the grid. Generic; using UnityEngine; using UnityEngine. For this, you can use the ink dropper tool to select a color from the Scene. Zero outputs to console, and zero difference in the Oct 21, 2013 · 1. Unity has many built-in components Jul 28, 2015 · Hello I’m making a 2D game For my tests I used sprite as ennemies, and I used the spriterenderer component to change it’s color on the fly to tell the player that it was selctable (the sprite turned blue in order to tell the player that it can click on it) Now that my prototype is more “elaborate” let’s say, i’m not working with sprite as ennemies but with gameobject that contains In this Unity UI tutorial, I'll show you how to easily change an image color and set this to a color you specify in the inspector. Lerp in a coroutine function. The ID changes between player runtime and Editor sessions. Ex: Renderer renderer; void Start() { renderer = GetComponent<Renderer>(); } void Update() { Color oldCol = renderer. Jul 22, 2017 · Hi, I tried something like this where the GameManager calls a method from the script FlagSpawn which is attached to an empty Game Object called FlagSpawner, but it doesn't work. So you’re following the Roll-A Aug 1, 2019 · 3. 0 = opaque. May 3, 2022 · Create a list or array with the colors, then use random. color = newColor; Nov 23, 2021 · 📢 Music:https://www. void Start() Color newColor = new Color (0. GetComponent<MeshRenderer>(). This specific video looks at changing the color of the character’s racing kart, but you can follow these Apr 5, 2019 · i am new to unity and i am working on developing car related app where modification of car can be dynamically done like body color and tire change based on user selection. black; answered Apr 9, 2020 at 12:41. int cubecnt = 0; // increase this when you instantiate a cube. This is to represent a machinegun glowing and burning red as it overheats as the player holds down the fire key. Output: « Check if a page is completely loaded or not in Selenium web driver in Python. 5f); Now to your second question on how to change a texture at runtime. b, oldCol. Hello all, I am attempting to script up something that causes a gameobject to gradually change color while a key is held down. Find(“Button1”); buttonclr. material. r, oldCol. @goutham12 , your answer isn’t wrong, but it’s really simple. red); SetColor(wallTall, Color. When you enter Prefab Mode in isolation, Unity only shows the contents of that Prefab in the Scene view An interactive view into the world you are creating. Nov 23, 2022 · private Renderer rend; [SerializeField] private Color colorToTurnTo = new Color (1f, 1f, 1f, 1f); void Start() rend = GetComponent<Renderer>(); rend. Use the Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. Returns the first instantiated Material assigned to the renderer. Modifying material will change the material for this object only. Mar 25, 2022 · The first three numbers are responsible for the color of the object (R, G, B). By clicking in the Inspector inside “Main Color”, a color picker will pop-up, and you can Sep 1, 2017 · GameObject buttonclr = GameObject. You press or cluck the UI button and a gameobject that has some material attached changes Aug 4, 2020 · In the unity editor, it is possible to set the position based on anchor presets such as : My goal is to be able to do this via code. If the material is used by any other renderers, this will clone the shared material and start using it from now on. This event is sent to all scripts attached to the Collider. color; Color newCol = new Color(oldCol. renderer. bool isScaling = false; IEnumerator scaleOverTime(Transform objectToScale, Vector3 toScale, float duration) {. Returns a solid red Color. rend = GetComponent<SpriteRenderer> (); // gives functionality for the renderer. We'll also discuss setting Description. Oct 7, 2016 · Laperen. Part of the issue is that it has been difficult to Jan 24, 2012 · Tasarran January 24, 2012, 9:54pm 2. material should be used to change their individual colors. If the script is attached to the GameObject that has the renderer which is handling your material try: void Start() {. Set the Color property to a color that suits your skybox. Mar 28, 2023 · Here's the thing they are linked, I even changed the name of the gameobject, named said gameobject in the code and re-connected it to the canvas and the component itself. x individually unity hates that for whatever reason. materials*. I tried something like this (I'm not sure that this is best way to do this, but it's only one I got idea for): hovering = true; xpos = Input. white); private void SetColor(SpriteRenderer sprite, Color color) sprite. A more simple solution would be to simply add multiple materials to the object. 78f, 0, 0, 1); Dec 27, 2014 · Alpha 0. Jul 4, 2018 · Im working on having an object change color and its collision box be disabled when the player clicks on it, it works, my issue is that it wont change back as soon as the player stops pressing it. CreatePrimitive( PrimitiveType. Please, do not make any changes to your username or email addresses at id. Dec 29, 2020 · 3. GetComponent<Renderer>(). magenta; buttonclr. The easiest way of changing a tinting color of an object is by changing the material's color, but the problem is this changes it for all GameObjects that are using the material. // call this in function of button/key pressed or whatever. Use it to change or compare the Color of a GameObject. . zl cy zl wx rk ps md xe pf tj