Community Tutorial: Solved - TryConvertFilenameToLongPackageName ObjectPath warning

Warning: TryConvertFilenameToLongPackageName was passed an ObjectPath rather than a PackageName or FilePath.

https://dev.epicgames.com/community/learning/tutorials/qMy2/unreal-engine-solved-tryconvertfilenametolongpackagename-objectpath-warning

3 Likes

Thank you!

is there a function that actually converts from object path to package name.? removing the part after the dot seems a bit ad-hoc.

There is a different way to do this without appending/splicing strings. Now you can use Asset.GetSoftObjectPath().GetLongPackageName()

4 Likes

Is there a way to do with with bluebrints? im not sure where to edit or add these lines of code, still learning. Im having this problem with OpenLand which is a plugin.

Fixed code up until 5:20 in the video:

def getAssetClass():

    EAL = unreal.EditorAssetLibrary()
    
    assetPaths = EAL.list_assets('/Game')
    
    for assetPath in assetPaths:
        assetData = EAL.find_asset_data(assetPath)
        assetClass = assetData.asset_class_path.asset_name
        print (assetClass)

apparently the warnings of

LogPackageName: Warning: TryConvertFilenameToLongPackageName was passed an ObjectPath … Accepting ObjectPaths is deprecated behavior and will be removed in a future release

is harmless and nothing in the 5.3 python documentation discusses alternatives.