how to instantiate a gameobject in unity with a material attached to it with same texture but different offset setting. Am generating a bunch of game object from a single prefab with same texture but different offset. My problem when i change the offset or one other game object offset also get change.
Use code like this for your Pool,
look at line 38 of the code where you set the name of the pool item
directly after that, just set the offset, using “newy”
So something like
newy.renderer.material. SetTextureOffset ...
Read this doco
“Modifying material will change the material for this object only. If the material is used by any other renderers, this will clone the shared material and start using it from now on. Important note: This function automatically instantiates the materials and makes them unique to this renderer.”
Further … memory management …
Note that if you are programming in a sophisticated manner, then: “It is your responsibility to destroy the materials when the game object is being destroyed. Resources. UnloadUnusedAssets also destroys the materials but it is usually only called when loading a new level.” Generally you won’t have to worry about that but bear it in mind if you have a highly dynamic game.
hope it helps