Hey everyone,
For a large project, say I have collection of scripts in a folder in Unity, but how to find out what script is used as a script component under what game object(s) ?
Regards,
zeropoint
Hey everyone,
For a large project, say I have collection of scripts in a folder in Unity, but how to find out what script is used as a script component under what game object(s) ?
Regards,
zeropoint
Hi Nikolay,
Thanks, I know accessing components through script which is what the article you mentioned says.
What i m looking for is something in IDE (probably) through which we can get all the game objects to which a particular script is attached as component.
Put the following in a file named GetComponentLocations.js, in a folder named Editor.
Replace “Actor” in the following with the type of whatever it is you’re trying to find.
Choose one object of that type, then, in the inspector, you’ll find a “Update uses” toggle - click that to find all objects of the type. You can then click any of those and it will locate the object in the Project or Hierarchy pane.
@CustomEditor( Actor )
class GetComponentLocations extends Editor {
var objs;
function OnInspectorGUI() {
DrawDefaultInspector();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel( "Update uses:" );
if ( EditorGUILayout.Toggle( false ) ) {
objs = Resources.FindObjectsOfTypeAll( typeof( target ) );
}
EditorGUILayout.EndHorizontal();
if ( objs ) {
for ( var i in objs ) {
EditorGUILayout.ObjectField( i, typeof( target ) );
}
}
}
}
Thanks Vicenti,
i’ll try this n let u know
These Editor apis are quite overlooked