Trying to get a variable to identify
What I want to do is I want a door to open after someone enters a password into a widget I set up with blueprint. I created a C++ class to open the door which works and I am now trying to set up a if statement for it to open when a variable I created changes.
To make a variable I can access in both blueprint a c++ I followed this guide and my variable I created in gamemodebase c++ component now shows up in blueprint: https://wiki.unrealengine.com/Blueprints,_Creating_Variables_in_C%2B%2B_For_Use_In_BP
Now I am trying to introduce my variable into other .cpp files specifically the one that opens my door but the problem is its not Identifying. My suspicions are that I am missing #include.
Here is header file for my game mode:
And here is my .cpp c++ component for the door;
And here is the variable working in blueprint am trying to have it so when this is set c++ class for my door will take note of it and open the door according to my if statement.
You need to do something like this:
ACemeteryFPSGameModeBase* CemeteryGameMode = Cast(UGamePlayStatics:GetGameMode(GetWorld()));
if(CemeteryGameMode->GateKey > 1) OpenGate();
answered Apr 10 '18 at 11:05 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here