- Home /
Question by
KristijonasM · Apr 23, 2016 at 08:11 PM ·
colorgetcomponent
Get color from another script.
Hi, i need to get a colors from another script named "TankColorChange", which has two public color values
public Color Tank0;
public Color Tank1;
And transferer them to another script called TankManager and asign them to other variables.
public Color spalva0;
public Color spalva1;
public void Awake()
{
GameObject g = GameObject.Find("GameManager");
m_getTankColor = g.GetComponent<TankColorChange>();
spalva0 = m_getTankColor.Tank0;
spalva1 = m_getTankColor.Tank1;
}
i did something but it doesnt work.
Comment
your code looks so far correct, would you try it with replacing "Awake()" with "Start()"? im not sure if the values are deserialized before awake finishes
Your answer
Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
Changing two different objects renderer colour 1 Answer
I'm trying to change a material, texture or color and it doesnt work 0 Answers
How to access multiple components of a component at once? 2 Answers
Transferring Color from script on another GameObject to a GUI.Box 1 Answer