Search Unity

Is there a way to find all scenes that are using a prefab?

Discussion in 'Scripting' started by DavidC02, Apr 24, 2020.

  1. DavidC02

    DavidC02

    Joined:
    Jul 19, 2011
    Posts:
    152
    Like to get a list of where on the game the prefab is? And I don't mind the prefabs that get instantiated but rather on saved scenes, would that be possible?

    Thanks in advance.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,910
    You could probably write an editor script to do it - it would probably involve loading each scene and then searching for the prefab in the scene.

    How many scenes do you have? Could you just open them one by one and right click -> Find References In Scene on your prefab?
     
  3. DavidC02

    DavidC02

    Joined:
    Jul 19, 2011
    Posts:
    152
    Maybe, but it's over 80 scenes at this point.
     
  4. Oknaa

    Oknaa

    Joined:
    Jul 22, 2019
    Posts:
    8
    To you 2 years in the past.
    You might've already solve it but for better future here it is:

    => You can use this free asset in the Unity asset store: https://assetstore.unity.com/packages/tools/utilities/asset-usage-detector-112837

    => You can also go to the .meta file of the asset you want to look for, and take the "guid" value from it, its something like "28ef84a15857aea46abd58002c58ee0c". The go to the Git terminal and type "git grep <Your Asset's guid>", for example "git grep 28ef84a15857aea46abd58002c58ee0c".

    => Deleting the asset also shows where it was used, but thats a tricky business.