Is it possible to set per-instance material properties (baseColor)?
Hi,
I thought I had this working at one point but I guess I never thoroughly tested it. Is it possible to instantiate materials so that changing properties such as color through scripting is unique to each instance?
For example, I want an object to fade out but as I have multiple of these objects, I cannot make them fade individually by changing properties on their material's mainPass. The materials all share a single instance.
Thank you,
Bart
Try selecting all individual object meshes and see if it works
I'm not sure I understand? I'm spawning these meshes from prefabs, so they're not actually in the scene ahead of time.
One nasty solution would be to manually create 8 or 10 copies of the material (I'll never need more than that many at a time) and create a special script that provides a pool of them to individual objects, which obtain them on awake. But that's... eh... If Lens Studio already supports this would rather use a built-in solution :)
I don't believe you can instance materials. Each time I've seen something similar the script has been copying materials.
Ah you mean by using clone()? I just discovered this function. Not sure how I didn't see it earlier. I think this would suit my purpose.
I believe I am executing the spawn correctly, but when I attempt to use a prefab in the spawn code, it does not seem to be working. It's as though I'm trying to spawn a mesh that doesn't exist in the scene. Any insight would be greatly appreciated!
Reference: Livetvmesh