Hello. This is more of an attempt to snipe a Unity developer for some immediate feedback, as I’m pretty sure this issue has no external workaround.
I’m instantiating some objects in an editor script, and I need to be able to change properties of materials. Whenever I do this, I get an error that reads:
Instantiating material due to calling renderer.material during edit mode. This will leak materials into the scene. You most likely want to use renderer.sharedMaterial instead.
I don’t want to use renderer.sharedMaterial, because I’m trying to work with a few different objects, so modifying the sharedMaterial a second time will overwrite the changes I made to the first material.
I’m not instantiating a whole lot of objects (no more than have been placed by hand at one point), so I’m sure the “leaked materials” won’t end up being a huge problem, but nobody wants to see a mess of error messages when he clicks a button.
Are materials not instantiated outside of game mode? Is there anything we can do about this?