'return': cannot convert from 'URagnaOffensiveAbility ' to 'UObject
Jump to turn (6)
- 1'return': cannot convert from 'URagnaOffensiveAbility ' to 'UObject
- 2How should I pass an interface to a class using TSubClassOf in UE5?
- 3Could I create the class using the interface?
- 4Class 'URagnaBaseAbilityType' is not an interface; Can only inherit from non-UOb
- 5I have an interface and I want to create a base class uobject with the interface
- 6I am getting this error when I try to do this Severity Code Description Project
- User
'return': cannot convert from 'URagnaOffensiveAbility *' to 'UObject *
- Assistant
In Unreal Engine, UObject is the base class for most of the engine's objects, and URagnaOffensiveAbility is probably a class derived from UObject or another class that derives from UObject.
The error you are seeing means that you are trying to return a URagnaOffensiveAbility pointer, but the return type specified is UObject pointer. To fix this error, you can use a static_cast<> to explicitly cast URagnaOffensiveAbility pointer to UObject pointer. Here is the example code:
cppURagnaOffensiveAbility* Ability = ...; // Assume existing ability object UObject* Result = static_cast<UObject*>(Ability); return Result;