Hi,
I have a BP that has a custom cpp parent class
inside that parent class code, I need to know the asset path of that very blueprint
GetFolderName() returns “none”
How can I get the ‘\Game.…\Asset.Asset’ path of this BP ?
thanks
Hi,
I have a BP that has a custom cpp parent class
inside that parent class code, I need to know the asset path of that very blueprint
GetFolderName() returns “none”
How can I get the ‘\Game.…\Asset.Asset’ path of this BP ?
thanks
Hi phil123456,
It’s a little different in UE5 than UE4 - try actor->GetFolder().GetPath()
assuming you have an AActor* reference of the BP.
thx , but there is no GetFolder in AActor
@phil123456 You have it in Actor.h
/** Returns a FFolder that contains the actor folder path and its folder root object. */
FFolder GetFolder() const;
What version of UE are you using? That’s for later versions (5.1 up)
For previous versions use actor->GetFolderPath()
4.27
Yeah try actor->GetFolderPath()
GetFolderPath().ToString() returns None
If it’s empty it could be indicating somethings not right - can you go into a bit more depth of what you’re doing?
You could build you project in debug mode and set a breakpoint after getting a reference of your blueprint and then looking through it’s values to find more clues.
yeah but it says variable is optimized or something
as mentioned
I create a custom class from AActor
I change the parent class of my BP to that class
nothing fancy
So you’re trying to get the child BP path from the parent class?
Create a method in the parent - and then over-ride it in the child, returning the path - that would work if you’re calling from Blueprint, but not C++.
You could also have an FString in the parent, and fill that with the path on the childs construction script.
the parent class should not be aware of the child, this makes no sense
and the issue is that apparently adding static meshes to the root component can only be done in the constructor (of the parent)
so I need the path of the actual BP, not the parent class
I agree that the parent class should not be aware of the child.
You should be able to add static mesh components to the parents root component from child classes. The child class could well have a default scene root too that you can attach the mesh components too.