On line 622 you can see the parameters for the function include the ‘class’ keyword, so I would expect in Blueprint I would want to use class references.
If I use Class reference variables in the Blueprint, I run into issues once I get to line 638: ‘LocalLastWeapon->OnUnEquip();’
I can’t seem to call member functions from a class reference variable.
If I go with using Object references, there doesn’t seem to be a non-hacky way of setting an object reference to Null.
(In the picture above, I worked around this by creating a second variable of the same type)
Any suggestions as to which is the correct one to use?
No, the class keyword in this case is used to let the compiler know that the word AShooterWeapon is a class type, this is called a forward declaration. The parameters NewWeapon and LastWeapon are pointers to instances of AShooterWeapon, the equivalent in BP would be object references. In this particular case the forward declaration is actually pointless because the pointers passed into the method are dereferenced, which means the full declaration must be available at that point or the compiler will throw up an error.
And for future reference, the C++ equivalent of a BP class reference is UClass* or TSubclassOf<USomethingOrASomething>.
You just create a new SET node for the variable and leave it at that, by default it will set an object reference to None if you don’t specifically set it to something else.