I'm trying to access the MeshRenderer component from a Custom Editor, but I can't seem to figure out the syntax in C#.
In JS what I'm trying to accomplish:
var mat : Material = target.renderer.material;
In C#, this is what I've got:
GameObject go = (GameObject)target;
Material mat = go.renderer.material;
However, Unity tells me that I can't cast target as a GameObject.
↧