Referencing Variables - Accessed None... - Please Explain

As a rule of thumb. Keep the game logic out of the widgets. Do the key tasks in the actors, global stuff everyone needs to access can be kept in the framework classes (game mode, player controller, game instance even, and so on). Widgets are supposed to show stuff rather than do the heavy lifting.

I couldnt put it in the CharacterProfile widget because 100 button instances are being created, so the count var would always be 1.

That’s where the idea of managers comes from. You need an outsider to keep things in check. Game Mode can serve as one. Or you can have an actor dedicated to creating characters and keeping track of them. The game mode needs just a reference. Once the characters are created, that managing actors can be destroyed, freeing the necessary resources.

It’s a good idea to encapsulate logic in managing actors as the framework classes will eventually grow exponentially in scope anyway…

1 Like