Thank a lot! This one is simply the best.
Awesome, thanks you very much, can i right click a gameobject and have a menu find ?
i make a cheat
[MenuItem("GameObject/FindReferenceInOpenScene",false,0)]
public static void FastInit(MenuCommand menuCommand)
{
AssetUsageDetector window = GetWindow<AssetUsageDetector>();
window.titleContent = new GUIContent("Asset Usage Detector");
window.Show();
window.assetToSearch = menuCommand.context as GameObject;
if (window.assetToSearch == null)
{
window.errorMessage = "SELECT AN ASSET FIRST!";
}
else if (!EditorApplication.isPlaying && !window.AreScenesSaved())
{
// Don't start the search if at least one scene is currently dirty (not saved)
window.errorMessage = "SAVE OPEN SCENES FIRST!";
}
else
{
window.errorMessage = string.Empty;
window.currentPhase = Phase.Processing;
if (!EditorApplication.isPlaying)
window.initialSceneSetup = EditorSceneManager.GetSceneManagerSetup(); // Get the scenes that are open right now
else
window.initialSceneSetup = null;
// Start searching
window.ExecuteQuery();
}
}
Do you mean like right clicking a prefab and selecting âFind Referencesâ from the context menu?
right click a gameobject in scene and click FindSceRef in context menu, yes , i adding some code and itâs working. Thanks again !
Didnât see the code, sorry Good job.
Another thanks from me @yasirkula ! Iâve been meaning to write something like this as the âFind Reference âŚâ is basically useless in my project, and this does exactly what I want it to.
This is beautiful thanks!
Fantastic. Only thing I donât understand is why this isnât build into Unity from the start.
Well done!
Lol, thanks!
Now available on Asset Store!
@yasirkula Very nice tool. Thanks for this contribution!
Thank you sir, you save my time when ineed to find out where my asset use.
What?! Free!? Let me hit that download Asset Usage Detector now before you change your mind!
One thing I think I will try to add, and youâre welcome to add also, is a referential rule enforcement scheme. I have folders for âTHIS GAMEâ and âSHARED BETWEEN MY GAMESâ and âOFFICIAL ACQUIREDâ assets. Things in my SHARED folder are allowed to have references to OFFICIAL. Things in THIS GAME can refer to either one. But the other direction indicates bad practices. I donât think I want to try to do this through AssetPostprocessor to enforce it 100% full time, but I do want to audit my projects on a regular basis.
I think this use-case wonât apply to most projects, so Iâll skip it for now. But thank you for the suggestion!
What a great asset! Amazing this isnât built in. Thank you!
I love you right now.
Thanks
This is awesome, thank you! I have something similar implemented in python scripts, but its not very portable for the rest of our team.
Question, this asset seems to use a ton of memory, even when searching for one asset at depth 1. I measured up to 14GB of memory used to search my scenes in the project (there are maybe 30) for one asset (depth 1).
Is there any chance of reducing that memory usage?
Thatâs mainly caused by EditorUtility.CollectDependencies which loads all the objects in those scenes to the memory because it returns an Object[ ]. I think the only way to reduce the memory usage would be to cache these objectsâ GUIDâs on the first search and then reuse the cached data, as long as the scene doesnât change.
As my current project grows and my use of ScriptableObjects grows I knew Iâll eventually need something like this and Iâm super happy this already exists.
Fantastic awesome work!
Now I just need to figure out how to make this more friendly with ScriptableObjects when they are found inside my Behavior Designer trees (a great behavior tree plugin). You can see it of course but it doesnât exactly tell you on which task the object is found.
In any case - invaluable stuff! Thank you!