Download

How to create interface pointers?

Hi, this is probably a very basic question, sorry about that, but I’m storing an interface in my code with TScriptInterface and I just wonder if I need to put an * to it somewhere or is it a pointer by default, cause it doesn’t need it so I’m alittle confused.

TScriptInterface shouldn’t need any dereferencing on it, so it should just be TScriptInterface. I don’t know what the implications of adding it is precisely, but I believe TScripterInterface<UObject*> is a UObject** rather than UObject*. I don’t know enough about programming to clarify that though

TScriptInterface is just a struct wrapper for native interfaces, and is a templated version of FScriptInterface.
You treat it just like any other structure, and use its member functions to access the templated object.

There’s a little more to it as to why it’s used, which I have yet to delve into myself. Check out ScriptInterface.h, or the wiki page: