Dynamic create object error

I want to dynamic create object use C++.
QQ图片20160301184524.png


80570-qq图片20160301184524.png

AMaxLifeDefine inheritance AttrDefinitionBase.

A method is called. CreateAttributeDefineByName(“AMaxLifeDefine”).

log:
LogUObjectGlobals:Warning: Failed to find object 'AttrDefinitionBase /Script/gameAttributes/GameAttributeStrategyDefinition/AMaxLifeDefine

Shouldn’t the path be “/Script/GameAttributes/GameAttributeStrategyDefinition/AMaxLifeDefine” instead? This is what you have set AttributeDefineRelativePath in UAttrStaticLibrary::CreateAttributeDefineByName but the log says something else. I believe this is related to using FName. So some strings/names get changed for some reason. I’ve have this issue as well where my Blueprint variable gets renamed slightly from “Key” to “KEy” (wtf?!) so for me this is not that big of a deal but for you it could be causing that StaticLoadObject fails to find the object (since the path IS actually different).

You could try to change the LoadObjFromPath argument Path to type const FString& instead and see whether it will successfully load then. All you’re really doing is create FString AttributeDefineRelativePath convert to FName Path (after appending) convert back to FString Path.ToString() immediately construct FName from it (LoadObjFromPath call) and finally convert back to string (StaticLoadObject call).

Also why do you Append(TEXT(".")) ? Seems unnecessary but I may be wrong here.

like this.
https://wiki.unrealengine.com/Dynamic_Load_Object
I create Material.
UMaterialInterface* attr = LoadMatFromPath(TEXT(“Material’/Game/StarterContent/Materials/M_AssetPlatform.M_AssetPlatform’”));
It is right.
Right click on the M_AssetPlatform and copy Reference.The Path is Material’/Game/StarterContent/Materials/M_AssetPlatform.M_AssetPlatform.

Now I create is UObject use C++.
Now I want to instantiation this object.

Right this UObject get path is Class’/Script/TestCpp.AMaxLifeDefine’

But I don’t create this Object.

Log:
Failed to find object : AMaxLifeDefine /Script/TestCpp.AMaxLifeDefine

I don’t know the different between Content Folder and Script Folder.
Asset Naming Rule is what?
Thank you.