Skip to content

MeisterDerMagie/UnityPrefabTester

 
 

Repository files navigation

UnityPrefabTester

Alt text

Ultimate prefab property tester for nested prefab era. This is editor script to demonstrate ALL* prefab related API in Unity Editor. *(Except prefab variant related)

It will test/distinguish selected game object if it is "part of" or "root of" any prefab type. Including

  • Prefab Asset (The one that sits in Asset folder)
  • Prefab Instance (The one that dragged into scene)
  • Prefab Stage (Editing prefab intermediate in UnityEditor prefab edit mode)

Including resolve nearest asset path, root of prefab if available.

To try the example API, import package or open demo project. Select menu Tool->Prefab tester API example

Related API used:

  • PrefabUtility.IsPartOfPrefabAsset
  • PrefabUtility.GetNearestPrefabInstanceRoot
  • PrefabStageUtility.GetCurrentPrefabStage
  • PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot
  • AssetDatabase.GetAssetPath

Possible useful scenario:

  • Useful for some editor script automation based on prefabs.
  • Originally, I write this code to fix Mirror network plugin issue on determining assetPath on NetworkIdentity in complex cases which my game is using.

About

Ultimate prefab property tester for nested prefab era.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%