Hello, I’m new to Unreal Engine, I just came from Unity, and I’m trying to create a simple game for learning things in Unreal, and I found it’s very difficult to understand sometimes.
I’m trying to Get Overlap events from my custom actor that is Plane object, it has its own collision that will block anything and box collision that I want it to be the trigger of my function.
the Object is already be put in scene, not be spawned in realtime.
the box component is already be acttached to the object, not be created in realtime.
and when I looked into the how to in internet, people always use CreateDefaultSubObject instead of using GetComponents which I usually use in Unity. And I’m very confused why people do it this way. Can anyone lighten up for me? and how should do it in the proper way? Thank you.
The reason for CreateDefaultSubObject is to instantiate the component during the objects construction phase. It’s just an extra step to creating the component in code, without it components just a definition in the header file.
Unity is different in this aspect that it’s c# which doesn’t have the distinction of header files and cpp files.
In unreal you can use
GetComponentByClass or the plural form GetComponentsByClass