Saturday, October 8, 2022
HomeGame DevelopmentTips on how to increment a counter shared between a number of...

Tips on how to increment a counter shared between a number of objects?


I’ve 4 objects that begin off purple, all situations of the identical prefab.

The participant strikes as much as these objects and presses area to vary them to inexperienced.

Every object has an integer variable that will increase by one when the article turns inexperienced, and that worth goes down once more as soon as it adjustments again to purple.

The participant wants to vary all 4 objects to inexperienced worth earlier than the extent can advance

However every time an object adjustments to inexperienced, it simply increments the article’s variable from 0 to 1, even when the participant had already incremented the variable on different objects.

How do I get this integer to go up consecutively till it equals 4, and never simply going as much as one for each separate occasion?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments