- Home /
How do I set the current script as the selection in the project view?
I want to be able to highlight as script in the project view ( as well as use EditorGUIUtility.PingObject() on it if possible ) and I'm having trouble figuring out how to get that to happen.
Does anyone know how to set the Selection to a script by type or instance?
and
Does anyone know how to use PingObject() on a script either by type or instance?
Answer by stevethorne · Apr 24, 2014 at 08:26 PM
I figured out how to get the current script that I'm editing to be able to ping it.
Let's say I'm making a custom inspector for something. All I needed to do was get the MonoScript of the object that I'm inspecting.
EditorGuiUtility.PingObject( MonoScript.FromMonoBehaviour( target ) );
This solution doesn't work on scripts that aren't MonoBehaviours, but I believe that's because Unity has no support for pinging scripts that aren't MonoBehaviours.
Your answer
Follow this Question
Related Questions
Unexpected selection state in custom inspector? 1 Answer
Custom Material Editor 1 Answer
OnInspectorGUI - Using the default Object Selection popup. 1 Answer
Modify editor GUI content using mouse click 1 Answer
Custom Editor GUI Elements 1 Answer