Objects and References
We are now going to learn about objects and how to create interesting programs
Objects-is a thing (Adventurer)
- Data (experience, level)
- Functionality (Fire arrows, jump…)
- Player (using controller, player number, current input)
- List (Items (1,2,3,4), (remove last items add to the end of the list)
Actors- objects that can be added to our level.
If you go to the editor and look at the cube there is ton of data.
Components-Objets that can go on an actor
If you look at a component on an actor you can see the subset of properties that belong to the component.
For CPU usage conservation we use a reference instead which is like an address or where do I go to find the object in memory.
To create a reference to a cube we can select the cube in the editor and then go into our level blueprint and while the cube is selected right click and an option will appear to create a reference to the cube.
This tells us this is the cubes address. We have now found our cube. We can now ask the cube questions about it’s components.
Reference- Where to find an object
Data pin- input or output of data for a node
Execution pins — When to run the node
If we drag off of the cube reference pin we can use all of the functionality that cube has. We can get a reference to the static mesh.
We now want to find the name of the static mesh component.
The return value is that of a string so we can add a print string to our sequence to get the name of the Static mesh component.
We also have to connect the execution pin to our previous print string in our level blueprint or it will not run.
We are now going to get the mass of our static mesh component. So we are going to right-click and type get mass and we are going to add another print string. We are then going to bring the lines from the return value to the in string which will convert a float to a string, and hook up the execution pins as well. When we click play we see our mass for the cube it 1000
That is how to get references and functionality nodes in blueprint.