I'm just wondering if there is a way to give instantiated objects a unique id variable
The script I am working with, and thought should work is:
The reason being I want the different numbered instantiated objects to do different things. At the moment all the objects are receiving variableInScriptAttachedToPrefab equal to the maxObjects var (12), instead of 1, then 2, then 3, up to 12.
asked Apr 08 '10 at 06:13 AM
Your logic is sound - what you have should work.
However from the symptoms, it sounds like you've made your "variableInScriptAttachedToPrefab" a static variable.
Remove "static" from its definition, and it should work as expected.
answered Apr 08 '10 at 09:09 AM
You could do a few different things.
Just name that "ID.js" or something similar, and then you can get the component "ID" and check its value.
answered Apr 08 '10 at 08:01 AM