Renaming assets doesn't work with perforce integration

Branch: Source
Build version: 4.2.0-0+UE4 snapshot from github

After I had set up perforce integration in the editor, I tried to rename an asset.
This led to the following:

  • The asset was renamed in the editor
  • A new file with the ‘new’ name was created in the respective folder
  • The old file was modified - it had only 2KByte afterwards

Perforce registered the new file being added, but did not flag the old file for deletion. It seems like whatever operation was conducted when the renaming happened was not the correct renaming/moving from perforce

Repro:

  1. Set up your editor with a perforce connection
  2. Create an asset
  3. Check in the asset
  4. Check out the asset
  5. Rename it in the editor
  6. Notice how it isn’t properly renamed in perforce (the old file is broken and only has 2KByte, instead of being deleted)

I also tried to find a workaround, but didn’t manage to do that yet. I tried a combination of renaming manually in perforce, and renaming the asset to the very same name in the editor, and at some point the asset stopped showing up in the asset list at all. I wasn’t able to bring it back except for by reverting all changes in perforce.

1 Like

Hi,

This is expected behaviour. What is happening here is that the engine is creating a “Redirector” so that anything that references the old asset knows where to find the renamed version of it.

Check here for more info:

https://docs.unrealengine.com/latest/INT/Engine/Basics/Redirectors/index.html

1 Like

Thanks for the link, that explains a lot.

Is it correct that this behavior only shows up with a perforce connection? Without that connection this never happened to me.

This is also expected behaviour. When not using source control (and some other cases), redirectors do not need to be created because assets can be loaded and saved with no potential issues (i.e. clashes with other users that might have files checked out), so references can be fixed ‘there and then’.

Another exception is when an asset is directly referenced by a map - maps generally take a long time to load so we don’t fix up the references straight away, we leave a redirector instead.

I understand. Thanks for the info!

Looks like this behavior is being updated to preserve perforce history: https://answers.unrealengine.com/questions/69356/perforce-integration-renaming-moving-workflow-bugs.html