- Home /
Custom Editor - Is there any way to detect whether the user is in Prefab editing mode?
I'm trying to make a custom editor for a script that spawns a prefab, and would like to be able to drag the GameObject prefab I want to spawn into the editor window to assign it. However, this prefab I want to spawn isn't something that would needed to be changed per object and I would prefer if it didn't clutter up the inspector and distract from the relevant options that actually would need to be changed.
Right now my solution is to hide it in my custom editor after it gets assigned, which works, but I was wondering if there was a way to have the field pop up when the prefab the script is on is being edited (like when you double click a prefab in the projects view). This way I could edit the variable without having to go into the script and also not have it clutter up the space in the inspector on each instance of the object.
Any assistance or alternatives would be much appreciated :)
Answer by SmallLion · Dec 07, 2020 at 01:24 PM
@Kelzak Can you explain that briefly please?It is not a your wrong,problem is English is not my mother language.I'm sorry.But I think I can answer your question.
They asked if it was possible to in code find out if you are currently in prefab editing mode.
i.e. if you press this button
Your answer
Follow this Question
Related Questions
How to get EditorWindow client rect? 1 Answer
Positioning a button at the bottom of an editor window 1 Answer
SearchableEditorWindow 2 Answers
Recreate default editor look manually without base.OnInspectorGUI [UnityEditor] 2 Answers
Member arrays not initialized in editor until after scripts are recompiled 1 Answer