- Home /
Incrementing value of property in prefabs by 1 each time it's instantiated?
Hi, first of all, I'm a noob when it comes to coding.
I have a tile road building system that will be created from many version of the prefab, there is only 1 prefab, the version switching comes from the offsetting UV inside the shader, by which I just increase the integer each time by 1. I managed to utilize Material Property Block and put the property into the inspector of the prefab (I named it _VariationCycle) by using a script, and from here I can change it manually for each tile, every incremental by a value of 1 will switch the tile version, and it can even go up to any number. From here on I just stuck, because I need this number to increment automatically each time it's created.
Can anyone point me to the right direction? I feel like I'm so close now.
Your answer
Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
Checking if object intersects? 1 Answer
Can't access enum property of an instantiated prefab. 1 Answer
How to access property of a prefab before Instantiating. 1 Answer
How to access Instantiated GameObject's attached script's values? 1 Answer