Gentlymad-Studios / NewGraph

A general node graph solution centered on data management. This is based on the idea to visualize complex data structures as graph networks without having to modify already established data classes.
MIT License
244 stars 19 forks source link

Closing/re-opening project ScriptableGraphModel.asset not found #40

Closed akatriel closed 9 months ago

akatriel commented 9 months ago

Produced in Unity 2023.2.3.16f1 Upon closing and re-opening project the AssetDatabase appears to lose the reference to the ScriptableGraphModel.asset with the following error:

settings blueprint could not be resolved! Path: Assets/Scripts/Editor/NewGraph/Editor/Settings/GraphSettings.asset GUID: 015778251503b3c44a2b9dfc3a36ad10 UnityEngine.Debug:LogError (object) NewGraph.GraphSettingsSingleton:get_BlueprintSettings () (at Assets/Scripts/Editor/NewGraph/Editor/Settings/GraphSettingsSingleton.cs:34) NewGraph.GraphSettingsSingleton:get_Settings () (at Assets/Scripts/Editor/NewGraph/Editor/Settings/GraphSettingsSingleton.cs:55) NewGraph.GraphWindow:InitializeWindowBase (System.Type) (at Assets/Scripts/Editor/NewGraph/Editor/Views/GraphWindow.cs:80) WindowInitializer.WindowInitializer:OpenWindow () (at Assets/Scripts/Editor/JobClassGraph/WindowInitializer.cs:12)

WindowInitializer was moved out of the Sample folder to a Scripts > Editor folder but has been unchanged:

namespace WindowInitializer {
    public class WindowInitializer {
        /// <summary>
        /// Here you can customize where the graph window menu should appear
        /// </summary>
        [MenuItem("Tools/" + nameof(GraphWindow))]
        static void OpenWindow() {
            // Here you can define what type of graph model you would like to use.
            GraphWindow.InitializeWindowBase(typeof(ScriptableGraphModel));
        }
    }
}

Any help appreciated!

Doppelkeks commented 9 months ago

Did you install NewGraph as a package or did you clone it locally? Sadly, there is a Unity bug the results in broken references when using git repos as packages. :/

akatriel commented 9 months ago

OdinSerializer was installed as a package, however, GraphViewBase and New Graph were cloned locally into Assets > Scripts > Editor.

Doppelkeks commented 9 months ago

Hey, New Graph has a runtime and an Editor portion so it needs to sit directly in the Assets Folder or insides a Plugins folder, so maybe that is part of the problem 🙂

akatriel commented 9 months ago

Unfortunately, the error still exists even after completely removing it from the project and then re-copying the libraries to the Assets folder.

akatriel commented 9 months ago

I think the WindowInitializer.asmdef was the issue here. In my project preferences under External Tools > 'Generate .csproj files for:' > 'Embedded Packages' and 'Local Packages' are both checked. After copying the WindowInitializer to Assets>Scripts>Editor folder and deleting the .asmdef everything seems to work. Not sure why this would be related, but also not questioning this anymore...