Quantcast
Channel: Questions in topic: "loadassetatpath"
Viewing all articles
Browse latest Browse all 62

Change material with EditorScript

$
0
0
I try to change the material of a gameobject in the editor by a EditorScript. I use this code: if(boolean == true) { var newMat = AssetDatabase.LoadAssetAtPath("Assets/blue.mat", typeof(Material)); if(newMat != null) Debug.Log("Asset loaded"); else Debug.Log("cant find asset"); target.renderer.material = newMat; } when i click the boolean in the EditorScript my debug log prints "Cant find asset".

Viewing all articles
Browse latest Browse all 62

Trending Articles



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