Hi, recently I realized that instead of using boolean variable, we can just use groups, example:
Let's say we have player and enemy. If player has sword, enemy runs away. If not, enemy attacks player. In the player script, we can declare:
var has_sword : bool = true
Then enemy checks that:
But instead, we can just add the player to group "has_sword", and then enemy checks:
I'm just wondering, if one of this options is more efficient than the other (consumes less RAM). Also, imagine we have 15 global variables in code, and every of them can be replaced with group, so maybe we can have smaller code (we don't declare groups on top). What do you think?