Skip to content

Handling VPE specific prefabs tags metadata (could be extended to all metadata and all assets) #348

@Vroonsh

Description

@Vroonsh

This issue shows up while starting to work on the Prefab Library Editor.

Here's a view of a really early draft of the Prefab Library.
PrefabLibrary_v0

This library works by looking for all PrefabLibrarySettingsAsset into the AssetDatabase and populate all prefabs from the directories pointed by all those settings assets.

  • each prefab should have a set of tags/labels to help authors finding them back easily.
  • we also want these tags to be organized within categories (like Manufacturers, Decades, PartTypes, TableName...), some of them could also be un-categorized (part serial number or some common labels like colors).
  • we could create new tag/label but it should be managed to fit some rules (new tag into existing categories, protected categories and tags...)
  • tags/labels have to be binded the their prefab in a way.

For now i thought about 3 solutions which could match those requests :

  1. The tags are globally stored in the PrefabLibrarySettingsAssets.
    • Pros :
      • easy to setup and manage (all tags are together at the same place)
    • Cons :
      • specific solution for prefabs & tags only
      • need a directories monitoring to synchronize tags with any asset move/delete
      • the monitoring can be only done by the Editor or any other manager knowing all the PrefabLibrarySettingsAssets to transfer tags data alongside assets.
  2. The tags are stored into the userData field of the .meta file attached to the prefab, i made some tests with a Json serializable PinballMetaData class hosting a polymorphic list of PinballMetadataExtension (the first one is a PrefabLibraryExtension hosting a tag list).
    • Pros :
      • tags are following their prefabs
      • could work with other assets
      • PinballMetadata could be extended with other extensions if needed
      • another editor could expose the PinballMetaData embedded into any asset's userData
      • could be a real VPE specific metadata management, specifically made for our project
    • Cons :
      • have to be sure asset duplication is also duplicating the .meta userData (didn't find any Copy/Paste feature for assets in the editor, have to try while duplicating asset through scripts)
      • could collide with another userData usage (shouldn't happen)
      • need specific edition for this custom metadata system (probably mimic the current label edtion from Unity)
  3. The tags are stored as Unity labels into the .meta file.
    • Pros :
      • already editable through the asset properties editor, still didn't found a way to edit those outside from the Assets base directory (like in the HDRP package)

        image

      • stored as labels in the .meta file, already handled by Unity

      • should also be viewable in the Unity Asset Store (tbc)

    • Cons :
      • cannot edit elsewhere than Unity usual labels edition because of the internal protection of all label edition classes in UnityEditor, or classes has to be mirrored into VPE.Unity.Editor (which lead to nearly a custom edition solution).
      • cannot monitor & correct labels formatting in a convenient way, will have to be hooked when the asset is saved probably.
      • no categories supported in the edition, will rely on tag formatting with separator like those shown in the asset properties editor screenshot, no real label filtering so our labels will be aside the other default ones in lists.
      • Asset Properties Editor hide labels as long as the asset is not in the Assets/ hierarchy, cancel any edition/viewing of labels for package prefabs using this editor.

I'm not really found of the first solution (it was my first thought, the lazy one :))
I like the second one, maybe not easily traceable, could lead to data loss in case of weird assets manipulation, will probably need some heavy custom edition effort.
The third one is kinda integrated into the Unity ecosystem but will have to be heavily customized (UnityEditor classes duplication) if we want to have a slightly different user experience while dealing with VPE assets.

While thinking about this particular topic I thought that it could be a wider discussion about VPE asset's metadata.
What's your opinion on that ?

Cheers !

Metadata

Metadata

Assignees

Labels

editorEditor-related changes for UnityquestionFurther information is requestedunityConcerns the Unity project

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions