How to implement a UE4 singleton

UTom
Fri, 17 Sep 2021 18:29:57 +0000
C++

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?

1 post - 1 participant