Hi!
first of all, let me introduces my self: i’m an engineer with and MSc in AI building robotics simulators on my spare time. I’ve started with UE4 a few weeks ago, and everything is going smoothly.
I’ve set up a City Simulator, with Cesium Plugin and so on. I have an array of elements placed during Game Mode Base initialization, without any issue. Also, I’ve a Game Controller to read keyboard inputs to interact with the simulator’s elements.
I would like to access that array of elements from every element in the game (i.e. to change camera views, linked to each element). As far as I understood, the Game State would be the place to store my elements array. I’ve look for any good example to define my own Game State class, without success. Also, I have attached the custom class from the editor, but I cannot access its elements, no matter from where.
My custom Game State class looks like:
UCLASS()
class VERTIPORTSIMULATOR_API ASimulatorState : public AGameStateBase
{
GENERATED_BODY()
public:
TArray<AVertiport*> VertiportList;
TArray<AVertiport*> GetVertiportArray();
};
I’m getting errors initializing the Game State on the GameModeBase:
…
GameState = ASimulatorState::StaticClass() //This is not working.
…
So, here is the question:
- What is the proper way of instantiating a custom Game State class?
- Is there any good tutorial or example to manage custom Game State?
Thank you very much for your help. Best,