Download

Problems switching gamemode from blueprint to c++

So my blueprints started to get a mess and I’m working on converting some over to c++ (while learning Unreal coding). I have an issue using blueprints with my c++ class. So here is a section of my gamemode BP:

bzmvQbJ.png

When it was a blueprint that cast worked. Now that it’s C++ it doesn’t.

What I have done is create a new c++ class for gameMode, create a blueprint from that class, copy/pasted the blueprint stuff from the old into the new, and then selected that as my default gamemode.

The cast now fails.

My plan was to slowly start replacing blueprint lines with code to keep my game working as I convert. Will there be a lot of blueprint stuff that won’t work now that it’s also a C++ class and is there a way to fix this? Thanks, sorry for being so newb :).

There’s a bug I don’t know if was fixed; but when you re-compile C++ class your blueprint would lose parent and would reset to default base class, in this case GameMode.
Check your blueprint’s parent class (in Class Options under Class Settings) and make sure it is a child of your C++ game mode or if it did reset to child of GameMode instead.

Thanks for the help, I just figured it out poking around.

I forgot that playerState class was selected within the gamemode instead of the world settings like gamemode. So all I did wrong I guess is when creating a new c++ gamemode I didn’t set the playerState again.