Download

How to implement a ue4-conform-singleton for global variable access?

Hi all,
i wanted to create a singleton variable for an FSocket for the whole game. Filling a UPROPERTY pointer in the constructor of my AnimInstance inheriting object hasn’t been successful (for reasons the constructor was called multiple times, even at the start of the ue4 editor). This also counted for starting the game.

I already read in the forum about subsystems or game objects to inherit from, in order to get “global” singelton variables - However i didn’t understand how to access then the FSocket or other singleton variables if they are members of the derived class. Can you please provide an example how to do this?