Question by
SunnySeb · Jul 05, 2021 at 11:20 AM ·
materialinstanceinstantiate prefab
Instantiate a prefab material
Hi, I can't find how to add a prefab on the scene by script, without having a material instance. I do it this way:
m_lastSpawnedObject = Instantiate(m_ObjectSpawned, transform);//set as a child
m_lastSpawnedObject.transform.localPosition = SpawnPosition;
At this point I checked the newly created object material, and it is already an instance.
Then I set the material this way, but material is still an instance:
m_lastSpawnedObject.GetComponent<Renderer>().sharedMaterial = material;
Please help! What I'm doing wrong?
Comment
Your answer
Follow this Question
Related Questions
how to change a texture on instantiated prefab? 0 Answers
Serialize a string without (Instance) 1 Answer
How can I access material of a mesh renderer without receiving and instance of it? 1 Answer
Material instance unwanted 1 Answer
Why do my first 50 instances of a prefab have the same properties? 1 Answer