Skip to content

BaseDataObject asset GUID is editable without Odin Inspector #17

Description

@wallstop

Version

com.wallstop-studios.data-visualizer 0.0.37 (0bb4527fb29ff9d69c8d3c262180f742b4b004ac).

Problem

BaseDataObject._assetGuid is serialized and receives [ReadOnly] only when ODIN_INSPECTOR is defined. In a standard Unity inspector/DataVisualizer InspectorElement, the backing field is editable. TrySetAssetPath() repairs only an empty GUID, so replacing a valid GUID with another non-empty string persists the corruption. Id then stops matching AssetDatabase.AssetPathToGUID(path).

That breaks consumers that treat BaseDataObject.Id as stable asset identity. Qora now defensively repairs its derived asset id, but every non-Odin consumer inherits the same surface.

Reproduction

  1. Create any concrete BaseDataObject asset without ODIN_INSPECTOR.
  2. Open it in DataVisualizer or Unity's standard inspector.
  3. Edit Asset Guid to a different non-empty string.
  4. Save/reload.
  5. Observe asset.Id != AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(asset)).

Expected

The GUID is not authorable and remains equal to the asset path GUID after ordinary inspector edits, clone/create lifecycle operations, and reload.

Suggested fix

  • Apply the package's non-Odin read-only property attribute/drawer to _assetGuid, or hide it from ordinary editing while retaining serialization.
  • Make validation repair any mismatch, not only an empty value.
  • Add an Editor test that corrupts _assetGuid through SerializedObject, invokes the validation lifecycle, reloads the asset, and asserts the canonical GUID was restored.

No migration should be needed: the canonical value is derivable from the asset path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions