Hey all, sorry for this basic question. I feel that there are many references to this on the forums but I’m having troubles picking up what everyone is laying down…Could someone give me a basic background on this?
What I want:
- Update Material[×]
- Instantiate a prefab
- Assign prefab material[×]
- repeat for next instantiated prefab, leaving me with two copies of the prefab, Copy A = Color A, Copy B = Color B, etc)
Code:
print (prefab[1].renderer.materials[0] = new Material (material[0]));//Correct
//prefab[1].renderer.materials[0] = new Material (material[0]);//Incorrect
Problem:
The print line seems to output the proper data, If I try using this format to administer the change to the prefab i receive “Type Mismatch”
What I’ve tried:
Creating prefabs as described in unity docs / tutorials
Assigning prefab color from resources folder directly rather than calling for material[×] ref.
So far…no luck with any, and from what I’ve come across on the forums I feel this is just something really basic I’m overlooking ![]()