Non static functions in UObject class - accessing them in other classes

I’m having trouble with UE4’s UObject class and how to call non static functions within it.

  1. I created a class based from object. (UObject) called class1 for now.
  2. In class1 is a simple function called Test() (non static)
  3. I have my playercontroller class with #include “class1.h”
  4. I can’t call class1::Test() as it’s not static.

How do I initialize class1? Do I cast to it? And how?
Thanks for any help!

It works the same way as core C++ does. You have to instantiate your class (in UE4 with NewObject), after that you can call any member methods on the created object instance.

More info in the docs: UObject Instance Creation | Unreal Engine Documentation

Thanks very much, Kristof!