C++ Files and BeginPlay
We are going to begin working with our functionality of our C++ code.
In our C++ file for movingplatform we see the functions we would see in our event graph if we were to do this in blueprint. We are going to look at our beingplay function. We are going to access our values from our header file and update them in our c++ file. It is important to add after our Super:BeginPlay()
So if we were to run the editor our MyInt value has been updated from it’s defualt value of 99 to 9.
Now if we go back to our header file we are going to add a few new inputs to try to make a calculator.
Then we are going to go back to our C++ File to add them together. We are below our MyInt say APlusB = InputA + InputB; save and live code back in the editor. In the editor we can see the default values of the functions that we had added.
Now if I change A,B to 4,5 and click play we will get a result of 9.
We are now going to do the same thing with floats.
Before pressing play
As you can see we can add our C+D values together as floats.