Invoking a function in multiple scripts...

Hi. If I have several instances of an object/script, how can I invoke a function in all of them (for example, each instance of Script A has variable B in it, each variable B has a different value, but I want to subtract 1 from every variable B)? I know that static functions cannot reference instance data (like variables that would have different values …right?). Is there a way to work around this?

You could have all your objects with Script A be children of a single global game object and then send that global game object a BroadcastMessage indicating a Method in Script A that subtracts 1 from variable B.

Of, you could just use GameObject.FindGameObjectWithTag() and have tagged all the objects with Scipt As. Then, loop through the results and SendMessage() to them to call the Method subtracting 1 from variable B.

What you want to use is : gameObject.sendMessage()

Think it may do what what you need: