instance and static variables

I am creating a beanbag toss game and want each player to get 3 tosses, so I need to keep track of these in a static variable. When I instantiate the beanbag, I only want the active beanbag to get tossed.

Should I create a player game object that just keeps track of the number of throws so I can create a static variable or is there some way to do this in a script that is part of the beanbag itself?


Seems that you have two separate issues here.

First, you only want a beanbag to be used once - you toss it, and it ends up somewhere in the ground and stays there. That would be specific to the state of your beanbag item, so you could handle it there, and it wouldn't allow the player to select it after they've tossed it.

Second, you want to track the number of throws, and I would imagine other game information as well (for instance, the score). This you could just track on a single game object representing your player, which would be the one controlling the game state.