std::map doesn't copy to play in editor PIE / TMap
I'm trying to make a navigation graph from edges. At the moment, my class is set up like this:
When I am in the editor, the tick function draws the connections in the world (with DrawDebugLine) as I expect. However, when in PIE the debug lines do not get drawn, and a UE_LOG shows that the size of the map is 0.
I'm using an std::map with Key as a tuple (using the boost library) defining the two connected nodes and the map's Value being the cost of the connection (using this as a tutorial: https://www.youtube.com/watch?v=9-rliekgoAk).
In VolumeNavigator.h I have:
When an edge is made between two nodes, I am incrementing an int32 as well to denote the size of the std::map. This value gets copied (?) correctly when switching to PIE. But it seems that the std::map doesn't? Is that because I'm using std::map instead of TMap?
If that's the case, has anyone had success in using TMap with a tuple as the key? Switching just the type of my edgeMap causes a lot of compilation errors.
asked Mar 28 '16 at 02:13 PM in C++ Programming
Two things. The constructor for actors isn't always called when the game starts. It might be called when the actor is serialized. You want to put your thing in PostInitializeComponents or maybe BeginPlay
Second, Yes you should switch it to a TMap. You should try to use the unreal types as much as possible. They have wrappers for almost every stl type that you'd need, except they have added functionality specifically to support engine features.
answered Mar 28 '16 at 04:03 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here