Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LuizMoratelli opened this issue Dec 30, 2024 · 0 comments
Open

Comments

@LuizMoratelli
Copy link
Contributor

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.

@LuizMoratelli LuizMoratelli changed the title How to make Edtiro Create/Load only specific ScriptableGraphModel? How to make Editor Create/Load only specific ScriptableGraphModel? Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant