Skip to content

How to make Editor Create/Load only specific ScriptableGraphModel? #60

@LuizMoratelli

Description

@LuizMoratelli

Currently I have:

//MapGraphModelInitializer.cs
using NewGraph;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

public class MapGraphModelInitializer
{
    [InitializeOnLoadMethod]
    private static void AddWindowType()
    {
        GraphWindow.AddWindowType(typeof(MapGraphModel), typeof(MapGraphInspectorController), MapGraphModel.GetGraphData);
    }

    [MenuItem(GraphSettings.menuItemBase + "MapGraph")]
    private static void AddMenu()
    {
        GraphWindow.InitializeWindowBase(typeof(MapGraphModel));
        Debug.Log(GraphWindow.currentWindowType);
    }
}

public class MapGraphInspectorController : ScriptableInspectorControllerGeneric<MapGraphModel>
{
    public MapGraphInspectorController(VisualElement parent)
        : base(parent)
    {
    }
}
//MapGraphModelEditor.cs
using NewGraph;
using UnityEditor;

[CustomEditor(typeof(MapGraphModel))]
public class MapGraphModelEditor : ScriptableGraphModelEditor
{
}
//MapGraphModel.cs
using NewGraph;

public class MapGraphModel : ScriptableGraphModel
{
}

But when I click Load in GraphWindow it shows all ScriptableModeGraph as options to load, instead of just my MapGraphModel

image

If I could ensure it to be saved as the right type would be easier to reference around the places without worrying about someone attach a graph from other context to this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions