|
But keep previous Instantiate's texture the same..? I'm completely stumped by this, I can instance the same object with a different texture but the issues comes when it changes the previous instance's texture. An example of what I mean is, instantiating a prefab called Chap, like: Instantiate (Chap) with a blue texture, then Instantiate (Chap) again, with a pink texture.. Make sense? Anyone have any ideas or any links to code references that might help? Cheers. EDIT: Sorry, I'm not being very clear I'm having trouble explaining what I mean. I have a prefab of a person, with an unlit blue texture, I want to be able to instantiate the same prefab, in a different place with a different texture. The problem is with not changing the previous instatantiated texture aswell. Probably should have mentioned in JavaScript, so I apologize for that.
(comments are locked)
|
|
Aha! Managed to find some code already posted here that pretty much did what I need: Can you explain what you did in the end. I think im doing the same thing and want to have multiple "jeff" instances with different textures. How did you do it in the end? Thanks.
Jul 13 '11 at 09:33 AM
jammerjar
(comments are locked)
|
|
Hi There! If I understand what you're saying, you want multiple instantiated objects with the same texture? That is quite possible. Here's a quick demo (requires a gameobject and 3 textures). Here's some things to note: Each time you change the texture on a gameobject when unity is running, Unity creates a temporary instantiated material of that object. This means your changes don't go to the hard drive, and you're pretty much making each object completely seperate (think individual draw-calls if you want to use this on a phone or iPad in the future). You can't directly access an objects material, as it is rendered through either a Mesh Renderer or Skinned Mesh Renderer (for characters). A material isn't a component, so you can't use GetComponent on it directly.
(comments are locked)
|
