Skip to content

This is a tool for Unity Editor to look for missing references in assets. See supported types in readme.

License

Notifications You must be signed in to change notification settings

Realkek/UnityAssetChecker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity Asset Checker

This is a tool for Unity Editor to look for missing references in assets.

Supported types

  • GameObject (with any components inside)
  • Scene (with objects inside)
  • Material

How to use

  1. Open the Window menu and press "Asset Checker" and you'll see this window

2

  1. Press "Check assets" button to run check

  2. Since the check is finished you see a new window with two collapsed lists

image

image

Structure of list elements:

  • for asset object list - Object name | Component type
  • for scene object list - Scene name | Object name | Component type
  1. Press a button next to any object in the lists to go to the object

image

  • Object will be opened in Prefab editor if it's missing its script
  • Object will be opened in Inspector if its compponent missing any reference value
  • If the object is on a scene that isn't loaded then it asks you to load this scene

Principals of work

  1. Gets an array of asset paths through AssetDatabase.GetAllAssetPaths()

  2. Retrieves GameObject from each path using AssetDatabase.LoadAssetAtPath<GameObject>(path) and checks for null

  3. Then checks each GameObject and its children for:

  • missing components via ! operator (in this case the operator shows Object existance what is described here https://docs.unity3d.com/ScriptReference/Object- operator_Object.html).
  • component internal references that are missing via new SerializedObject(component) that makes us able to iterate SerializedProperty's and check them for:
    • serializedProperty.propertyType == SerializedPropertyType.ObjectReference (property derives from UnityEngine.Object)
    • serializedProperty.objectReferenceInstanceIDValue != 0 (property has value)
    • serializedProperty.objectReferenceValue == null (has no or missed reference)

About

This is a tool for Unity Editor to look for missing references in assets. See supported types in readme.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%