Skip to content

Stop treating assets deleted this session as still present - #68

Open
vbucc wants to merge 1 commit into
mainfrom
fix/issue-47-deleted-asset-paths
Open

vbucc wants to merge 1 commit into
mainfrom
fix/issue-47-deleted-asset-paths

Conversation

@vbucc

@vbucc vbucc commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

manage_asset treated an asset deleted earlier in the editor session as still there until the editor restarted. Moving, duplicating, creating or creating a folder at the freed path was refused with "already exists", and get_info and import on the deleted path reported success. Unity keeps a deleted asset's GUID for the rest of the session, and the default AssetDatabase.AssetPathToGUID overload keeps returning it. The existence checks now pass AssetPathToGUIDOptions.OnlyExistingAssets.

The same lookup had the same effect in two other places, and this PR fixes both:

  • manage_texture set_import_settings on a texture deleted this session reported success while doing nothing.
  • Renaming an open prefab's root (manage_gameobject modify with name) to the name of a prefab deleted this session was refused as a collision.

The option exists back to Unity 2021.3, so no compat shim is needed. The change is C# only: the Python tool and CLI just forward the parameters.

Issue: #47

Upstream: not fixed on upstream/main (v10.3.0) or upstream/beta (2026-10-17). Open upstream PRs CoplayDev#1459 and CoplayDev#1466 touch ManageAsset.cs but not this check.

Tests

  • 7 new EditMode tests: 6 in DeletedAssetPathTests and 1 in ManagePrefabsStageTests. All 7 failed on the old code for the reasons above. Each first asserts that Unity still returns the deleted asset's GUID, so none can pass vacuously.

Checks on this branch (dd9aae6d)

  • EditMode (headless harness): 1237 passed, 0 failed, 78 skipped. Before the fix, the same run had exactly the 7 new tests failing.
  • Compile check on 6000.5.5f1: passed.
  • pytest: 1680 passed, 18 skipped (no Python change).

Not landed. /land runs the version bump and the full gate.

🤖 Generated with Claude Code

Unity keeps a deleted asset's GUID until the editor closes, and the
default AssetDatabase.AssetPathToGUID overload keeps returning it. Three
existence checks used that overload, so a path freed this session still
read as taken:

- ManageAsset.AssetExists: move, duplicate, create and create_folder
  into the freed path were refused; get_info and import on it reported
  success.
- ManageTexture.AssetExists: set_import_settings on a deleted texture
  reported success while doing nothing.
- GameObjectModify: renaming an open prefab's root to the name of a
  prefab deleted this session was refused as a collision.

Pass AssetPathToGUIDOptions.OnlyExistingAssets at all three. The option
exists back to Unity 2021.3, so no compat shim is needed.

7 new EditMode tests, each seen failing on the old code for the reason
above.

Issue: #47

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant