20tab / UnrealEnginePython

Embed Python in Unreal Engine 4
MIT License
2.75k stars 746 forks source link

How to get type of an Asset? #728

Open Schizo opened 5 years ago

Schizo commented 5 years ago

How do i figure out what type an asset is?

import unreal_engine as ue
myasset = ue.get_asset('/Game/Framework/Hands/Model/HandAnimBP')

I only found the is_a method, but when doing from unreal_engine.classes import AnimBlueprint and checking for it, it returns False.

Any help appreciated.

tommyleo2 commented 5 years ago

/Game/Framework/Hands/Model/HandAnimBP is a package path. So you will get a Package instead of a Blueprint.

To get the actual blueprint path, you need to right click on the asset in the content browser and then click Copy Reference. You may find that the actual path is something like /path/to/blueprint/HandAnimBP.HandAnimBP.

BTW, get_asset is an editor-only method and will not be shipped in Shipping Build. You may need to use load_class instead.