+9
Working on it

Make Bolt folder structure portable within project

Oliver 9 months ago • updated by Lazlo Bonin (Lead Developer) 5 months ago 6 1 duplicate

Hey there, I have a suggestion for a quality of life improvement for Bolt. Most other packages of the same price point already do what I am about to suggest.

When keeping a project organized it is beneficial for plugins to not create several folders in the root project directory. The structure should be: 

  • Bolt


    • Plugins
    • Generated
    • Editor Default Resources
    • Etc

I realize that Editor Default Resources actually can't be anywhere but the root folder, but I know there are workarounds for that. Other packages have figure it out.

There should be no hard-coded paths and I should be able to move Bolt into any sub-folders in my project.


I would really appreciate this improvement and I am sure your user base would as well!

All the best,

Oliver


Duplicates 1

+1
Scheduled

I agree with you, and I decidedly tried to keep that to a minimum.

Every folder under Plugins can be moved elsewhere if you wish. Bolt analyzes its root paths based on *.root files located in each module (e.g. Ludiq.Graphs.root, by default under Plugins/Ludiq.Graphs). There is no hard coded path for this.

Editor Default Resources has to be a root folder to be used with EditorGUIUtility, and the only workaround I know for that is to move the assets under a Resources folder. However, if I did that, every icon in that file would be redistributed along with every build, which would add an unnecessary ~10 MiB bloat to all builds. 

Scratch that: reading the Unity manual again, it seems I could maybe place these assets under any Editor/Resources folder that is not at the root. I'll look into it.

The last folder is Generated. I could add an editor preference to the Ludiq framework for generated assets root, under assets, so you could have it point to /Bolt/ or /Ludiq/ if you want. Note that it must remain in a non-first-pass folder (e.g. not under /Editor/ or /Standard Assets/) for everything to work properly. Should be a fairly simple addition.

The roadmap is already pretty filled at the moment, but I've logged this in for v.1.4.

+1

Hey, there!

Perfect, you made my day sir. Thanks for putting up with my quips, I just want the product to be a perfect as possible. I am sure you also do as well!

I keep a folder called "Packages" and separate all asset store plugins in there for all of my projects, so I only really keep packages I can keep organized. I am a little OCD lol. (Aka I like Bolt enough to keep it even though it adds folders)

+2

Was just coming on here to ask for this same thing.  Will be nice to structure things more how we want. 

+4
Working on it

Getting to work on this.

I was hoping for a perfectly clean structure, but some things probably won't be possible.

The assemblies will have to remain in the same folder because of this old inheritance limitation (which is only confirmed to be lifted in 2017.3+, while Bolt supports 2017.1+): https://answers.unity.com/questions/594712/monobehaviours-editors-with-inheritance-across-dll.html

Moving Editor Default Resources will require keeping a per-plugin subtree for disambiguation when loading with Resources.Load (Not if EditorGUIUtility.Load keeps working as 1/2 doc page says...). 

Finally, I'll try refactoring the variables code to Bolt.Core instead of Bolt.Flow to place the variable assets in a Bolt.Core folder, because it makes more sense.

The top-level folder will be called Ludiq, because of the shared Ludiq Framework contents. For example, other Ludiq products such as Chronos 2 would use the Ludiq Framework that backs Bolt, so it would cause duplication errors to have e.g. Bolt/Ludiq.Core and Chronos/Ludiq.Core. However, you'll be free to rename it to Bolt if you only use that.

The final issue is the Generated folders. I think I will impose the restriction for the root folder (e.g. Ludiq/) to be outside any special folder. Otherwise, some generated scripts that need to be compiled last may not work properly. The alternative would be to provide an option for the user to specify a root generated folders path, but not only is this more complicated for me and for the user, it brings back the problem of having a non-nested generated folder, defeating the purpose in the first place. I believe that it's not too restrictive for users to keep the root folder outside a special named folder. However, you would be able to move it in a non-special named folder if you want to keep all your asset store plugins separate (e.g. Assets/Tools/Ludiq, or Assets/Store/Bolt, but not Assets/Plugins/Ludiq).

The new structure should hopefully be something like:

Assets/
    Ludiq/
        Assemblies/
        Ludiq.Product/
            Editor/
                Resources/
        Ludiq.Core/
            Bolt.Core.root
            Bolt.Core.ProjectSettings.asset
            Editor/
                Resources/
            Generated/
                AotStubs.cs
                link.xml
                Property Providers/
        Ludiq.Graphs/
            Bolt.Flow.root
            Bolt.Flow.ProjectSettings.asset
            Editor/
                Resources/
        Bolt.Product/
            Editor/
                Resources/
        Bolt.Core/
            Bolt.Core.root
            Bolt.Core.ProjectSettings.asset
            Editor/
                Resources/
            Generated/
                Variables/
                    Resources/
                        ApplicationVariables.asset
                        SavedVariables.asset
        Bolt.Flow/
            Bolt.Flow.root
            Bolt.Flow.ProjectSettings.asset
            Editor/
                Resources/
            Generated/
                UnitOptions.db
        Bolt.State/
            Bolt.State.root
            Bolt.State.ProjectSettings.asset
            Editor/
                Resources/
+3

Ok, bad news everyone, I just spent my whole day refactoring to hide the resources away in AssetBundles and it seems the editor isn't having it. I'll have to find another strategy, probably packaging them in the editor DLLs directly and loading them from memory.

The revised folder structure will probably look like this:

Assets/
    Ludiq/
        Assemblies/
        Framework/
            Ludiq.Product.root
            LICENSES.txt
        Bolt/
            Bolt.Product.root
            LICENSES.txt
            Documentation/
        Bolt.Core/
            Bolt.Core.root
            ProjectSettings.asset
            Generated/
                Variables/
                    Resources/
                        ApplicationVariables.asset
                        SavedVariables.asset
        Bolt.Flow/
            Bolt.Flow.root
            ProjectSettings.asset
            Generated/
                UnitOptions.db
        Bolt.State/
            Bolt.State.root
            ProjectSettings.asset
        Ludiq.Core/
            Ludiq.Core.root
            ProjectSettings.asset
            DotNetDocumentation/
            Generated/
                AotStubs.cs
                link.xml
                Property Providers/
        Ludiq.Graphs/
            Ludiq.Graphs.root
            ProjectSettings.asset

Hi,

this is fixed in the new version 1.3 which is already in Alpha version. Should be out officially soon.