here is my c++ code for the blueprint
template
static FORCEINLINE ObjClass* LoadObjFromPath(const FName& Path)
{
if (Path == NAME_None) return NULL;
return Cast(StaticLoadObject(ObjClass::StaticClass(), NULL, *Path.ToString()));
}
UFUNCTION(BlueprintCallable, Category = Game)
static UActorComponent *AddActorComponentFromPath(AActor *target,FName path,FName componentName )
{
if (path == NAME_None)
{
return NULL;
}
UObject *pComponent = LoadObjFromPath<UObject>(path);
return target->AddComponent(componentName,false,FTransform::Identity,pComponent);
}
after run this code the input parameter the path = ā/Game/BluePrints/Skill/A001.A001_Cā and the componentName = āA001ā . the truth is the pComponent is not null,but AddComponent is failed. why ? and how to resovle this problem