- Home /
Question by
CloverKitsune · Dec 05, 2012 at 02:39 AM ·
c#gameobjectvariablecolor
Assigning current color to a variable for fade out (C#)
I'm having trouble figuring out how to assign a game object's current color to a variable. I plan on altering it to make items of different materials fade out. Some of the variables I've tried are these:
public Color thisColor = renderer.material.color;
public Color thisColor = new Color (gameObject.renderer.material.Vector4);
but I get an error that an object reference is needed. I've tried it every way I could think of, but I don't understand what I'm doing wrong.
I also tried copying the example here: http://docs.unity3d.com/Documentation/ScriptReference/Color.Index_operator.html and while it stopped the editor from complaining, I couldn't make it do anything.
Comment