Make sure your C++ values don't overwrite your Unreal Engine values

I don’t know who needs to hear this but if you got puzzled midway through this lecture and wondered why all of a sudden your cubes went from moving up and down to slowly moving left and right, I found the problem. With EditAnywhere, you can set your variables both within C++ and Unreal Engine at the same time but if you set your variable values in C++ and then compile, your Unreal Engine variable values will be lost and it will use the C++ values.

So here’s my suggestion:

  1. Set your variable values in C++ if you want consistent behavior with your cube movement, for example: If you want all cubes to be moving in one direction and the same speed.
  2. Set your variable values in Unreal Engine if you want different speeds and directions of movement per cube.

So for #2, set your C++ variables as follows:


If you want to keep the C++ variables, just remove the comment lines ( // ) and set your values appropriately.

Edit: If you have any problems with it saving the values in Unreal Editor, make sure you go back and review this video: Live Coding Issues | GameDev.tv
To avoid that problem, try running a Run Build Task when making changes to the C++ header file (the .h file),