Reply To: How do make a script only affect one game object.

Forum Archive How do make a script only affect one game object. Reply To: How do make a script only affect one game object.

#36926
Jonathan Gonzalez
Participant

    Sounds like the issue might be related to your static variables. Not sure how those are being used, but if you had a static variable to detect when the animal should stop looking for food, then that variable will be the same for everyone. For example, if I had a health script and the health variable was static. Every object that has that script will have the exact same health. If I killed one enemy that had that script, then all enemies who had it would also die. In general, static variables should be used only when it needs to be a single global variable in your game.