Quantcast
Channel: Latest Questions by karl_
Viewing all articles
Browse latest Browse all 90

Custom Editor - Cast target as GameObject?

$
0
0
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.

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>