Accessing GameState(written in C++) variables and functions in Blueprints?
So I have my GameState setup in C++, and I've declared a variable to hold the number of players in the server, along with its Getter and Setter, and I've marked both as BlueprintCallable. I want to access this Getter and Setter from a BP, but whenever I do "Get Game State" and "cast to my Game State", I don't see either of these show up in the BPs. I've done this countless number of times with other C++ classes, and I'm not sure why it doesn't show up for Game State or Game Mode classes? Any insights on this would be greatly appreciated. Is this not allowed, and if so, why ?
asked Sep 16 '18 at 06:29 PM in Blueprint Scripting
It should work normally without issue there no blocks like that and blueprint in reality don't know any roles of classes, it job is just executing code whatever it is.
I notice other issue and i wonder why you not getting compilation errors or at least warnings aspecially from UHT, potentially pointing the issue. Reflection system does not support int type and that time should not be used in UE4 code as int does not have fixed size on all platforms and compilers, in ue4 you should use explicit fixed sized int types like int32 or uint8 (only those 2 types are supported by blueprint system, but other int times are compatible with reflection system and property editor)
First of all close editor before compilation which make sure hot reload is not on the way (it sometiems mess ups when you add new declerations), then click rebuild instead of build which will force UHT to read all header files again. It is UHT job to catch BlueprintCallable function and register them in generated code so blueprint editor could see them.
answered Sep 16 '18 at 08:36 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here