UPROPERTY Variables
--
We are going to be adding variables to our moving platform actor in C++.
We are now going to create variables in written code instead of doing it in blueprint.
If you open up your C++ Classes in your content browser navigate to MovingPlatform. You will see in your solution explorer a MovingPlatform.h and .cpp. The .h is your header and the .cpp is your C++. The header is where we can add in the functions and variables and the .cpp is where we do the coding.
Let’s start in the .h and add our variables. On line 10 you will see our class, the actor moving platform. We will be adding our variables within our curly braces.
We will be using an int32. Now if we want to be able to see this in the blueprint editor we must add a UPROPERTY and save when complete.
Go back into the editor and select and make sure live coding is turned on. This can be found in the bottom right corner.
We are now going to add another variable to our script that is a bool with a default value of true. Save and compile.
If you look at the moving platform and look in the details panel you will see the values we created.
Congrats now all of the default variables we have created our now attached to our moving platform class.