Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

How to check if the material is an Instance or an Asset?

$
0
0
Hello!
I'm changing materials of mesh renderers at a runtime when the character is frozen and when it gets back to normal.
Frozen material is an asset, it is always the same, and the main material is an instance (created in a runtime).
So I apply the material like this:
Code (CSharp):
  1.        
  2. protected void SetMaterial(Material _material)
  3. {
  4.     if (!_material) { return; }
  5.     for (int i = 0; i < renderers.Length; i++)
  6.     {
  7.         renderers[i].material = _material;
  8.     }
  9. }
  10.  
However,...

How to check if the material is an Instance or an Asset?

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



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