Quantcast
Channel: Answers for "Set the material the same as another GameObject"
Viewing all articles
Browse latest Browse all 4

Answer by robertbu

$
0
0
If you format your code fragments as code (i.e. use the 101/010 button, the <> will not disappear. It is unclear if the material you want is the one on the parent object. If so, you don't really need to use GetComponent. Instead you can do: renderer.material = transform.parent.renderer.material; ...though Unity is using GetComponent() underneath this line of code.

Viewing all articles
Browse latest Browse all 4

Trending Articles



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