x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Failed to rename assets using Python

I'm trying to rename an asset using Python. Here is my code:

import unreal as ue

ar = ue.AssetRegistryHelpers.get_asset_registry()

ad= ar.get_asset_by_object_path('/Game/Path/To/MyAsset')

rnd = ue.AssetRenameData(asset=ad.get_asset(), new_package_path='/Game/Path/To/', new_name='MyNewAsset')

rnds = ue.Array(ue.AssetRenameData)

rnds.append(rnd)

at = ue.AssetToolsHelpers().get_asset_tools()

at.rename_assets(rnds)

Unfortunately, this gives me error:

DataValidation: Error: /Game/Path/To/MyNewAsset contains invalid data.

DataValidation: Error: Data validation FAILED. Files Checked: 1, Passed: 0, Failed: 1, Skipped: 0, Unable to validate: 0

But the .uasset file is generated under the physical folder.

What am I missing here?

Product Version: UE 4.21
Tags:
more ▼

asked Apr 19 '19 at 12:15 PM in Packaging & Deployment

avatar image

kakyoism
6 4 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

As far as I know, you should use the file name with the virtual extension of it, so instead of

MyNewAsset

try to use

MyNewAsset.MyNewAsset

Let me know if it works?

more ▼

answered Apr 19 '19 at 03:24 PM

avatar image

SumFX
119 2 12 18

avatar image kakyoism Apr 20 '19 at 07:59 AM

Thanks for stepping in. After that, Unreal tells me:

LogPackageName: Error: DoesPackageExist: DoesPackageExist FAILED: 'MyNewAsset' is not a standard unreal filename or a long path name. Reason: Path should start with a '/'

LogAssetTools: Error: /Game/Path/To/MyAsset - /Game/Path/To/MyAsset.MyAsset to /Game/Path/To/MyNewAsset.MyNewAsset.MyNewAsset.MyNewAsset: Name may not contain the following characters: .

Couldn't rename 'MyAssetClass /Game/Path/To/MyAsset.MyAsset'.

Seems that Unreal does not like "periods' in names.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question