I tried to load SkeletalMesh like this but it returns Null
FString MeshPath = TEXT(“C:/Users/p/Content/Characters/Mannequin_UE4/Meshes/SK_Mannequin_Skeleton.uasset”);
FPaths::FileExists(MeshPath) returns True
but this one returns Null
UObject* BuffCharMesh = StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *MeshPath);
Hi @ScrewdriverHyena , thank you for answer, but currently everything is ok with mesh loading and issue in how to actually move bones in cpp code I unsuccessfully tried poseblemeshcomponent and control rig (you can’t reparent blueprint of control rig to cpp class) and currently I stopped on AnimInstance but it expects some pose in result and I don’t know which type should be where …
You can check attached GitHub repo for more details if you’re interested (I don’t want to copy-paste a lot of code here), will be great to get any feedback, questions or ideas how to implement that )
Hello, tempdeltavalue. Open your Content Drawer and locate the Skeletal Mesh. Select it, then right-click it; go to “Copy Reference”. This will copy the correct path. Paste it into your code.
Whenever you do this, you will notice that the file name and extension is always “yourAssetNameHere.yourAssetNameHere” instead of “youAssetNameHere.uasset”. I know that uasset is literally the extension when you are looking at your files in Windows Explorer, but that is not how Unreal Engine wants the filename and path.
BTW setting stuff up via paths is perfectly valid. For projects with many dynamically spawned objects and no blueprints its the only sane way to do it. Manually setting stuff up in the editor for everything doesn’t work in that case.
Hard-coding paths is most definitely bad practice. I’m sure there are cases where it’s perfectly valid- but setting the skeletal mesh for your character is not one of them in my opinion.
In cases where I find myself wanting to use a raw path, I generally opt to use a UPrimaryDataAsset with the properties that I need. If I’m working on something with no Blueprint subclass, I simply load the data asset as a property of a game class that I do have a BP subclass of, such as the gamemode or asset manager.
@e7t5i_x0z1@Shmoopy1701 Hi, humans , first of all, thank you for your attention to this issue and your comments , I will take them into account a little later
But as I mention above currently everything is ok with mesh loading (I just cannot edit original question here ) , I got mesh that I set in blueprint using GetMesh()
but it does not affect the skeleton in any way (and mesh is not NULL I see “horray” and “Pose mesh inited” in output log), currently I think about AnimInstance but I cant find needed type of pose to pass in some way (which I don’t know) into result from cpp
And in general I want to stay in cpp as much as it possible in context of current “task”