Custom OnSceneGUI-editor not working for ScriptableObjects?
Hello Internet,
I have a ScriptableObject...
[CreateAssetMenuAttribute]
public class PickupPosition : ScriptableObject
{
public Vector3 _position;
}
I want to visually edit the _position attribute within my scene. Preferably with a transform-handle:
[CustomEditor(typeof(PickupPosition))]
public class AreaEditor : Editor
{
public override void OnInspectorGUI()
{
Debug.Log("The Inspector-GUI gets called");
}
void OnSceneGUI()
{
Debug.Log("why is the SceneGUI not called?");
}
}
Defining the OnSceneGUI works for MonoBehaviours but not for ScriptableObjects. Editing properties of ScriptableObjects within the 3d-scene would be quiet convenient, but I can't find any documentation if or how this would be possible.
On a side note: I have a difficult time figuring out why some methods (like OnInspectorGUI()
) needs to be overridden whereas others ( OnSceneGUI()
, OnEnable()
, etc.) just need to be defined. I find this distinction quite arbitrary. Is there any documentation on that topic?
Any ideas or suggestions are highly welcome.
Answer by Esteem · Jan 31, 2018 at 02:20 AM
https://stackoverflow.com/questions/19957697/drawing-gui-stuff-in-scene-view-unity3d might be of use to you (y)
Your answer
Follow this Question
Related Questions
DrawGizmo - Accessing Editor script in DrawGizmo 1 Answer
Singleton ScriptableObject unable to Find itself, returns null 2 Answers
Scriptable Object issues when inside .dll 1 Answer
How to convert object types? 0 Answers
How to make an attack that moves the players position relative the target. 1 Answer