Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition
by John P. Doran, William Sherif, Stephen Whittle
How it works...
We create a new Actor based on StaticMeshActor for easy access to a visual representation via the Static Mesh.
UPROPERTY is added to give us a property to change, which causes PostEditChangeProperty events to be triggered.
OnConstruction is a virtual function that's defined in Actor.
As a result, we override the function in our class.
Within our class constructor, we initialize our mesh as usual, and set the default state of our bool property to match the visibility of the component that it controls.
Inside OnConstruction, the actor rebuilds itself using any properties that are required to do so.
For this simple example, we set the visibility of the mesh to match the value of our ShowStaticMesh property.
This could also be ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access