- Home /
Question by
GameCreator405 · Aug 29, 2021 at 05:41 AM ·
booleangameobjects
How do I check if a boolean variable is true on a group of gameobjects with the same script?
Is there a good way to see if a boolean variable on a group of objects with the same script is true, at all times? Should I use an array? Using a for loop to scan the objects every frame wastes too much power and there's no good way to know (that I know of) if all of them are scanned.
Comment
Answer by GeroNL · Aug 29, 2021 at 06:33 AM
Hello, can you just use a reference on the objects(make gameobejct of array /list public / serializable the private reference)? if not, just find it once(if its already in scene) in start or use boolean in update if already pass it, than while the reference(the whole objects in array or list) that already not null you can check it .