APawnTurret::StaticClass() function not very well explained

Hi,
the StaticClass() function is thrown at us in thes lecture and ‘explained’ within half of a sentence. I think I am not the only one, not knowing what it is, what it does and - most importantly - where to use this and where not to.

Cheers

To be fair to Rob that’s an incredibly hard thing to fully explain at this level. Here it’s being used to essentially pass a type as a value to a function.

1 Like

Ok, if it is that complex, is there a simple way to (just) notice, when XY::StaicClass() is neccesseary / what is the indikation for it?

It will be for UClass* parameters. Most of the time you would use it to pass the type as a value into a function.

SpawnActor(APawn, ...)

Isn’t valid syntax as you can’t just pass a type into a function. Functions take values not types.

The full answer is that UClass* is for the reflection data of a given class and that StaticClass() is to get that class’ UClass*.

1 Like

Thanks Dan, thats something :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms