Saving asset data for editor only

Hello,
I’m trying to create a node editor (like the one for animations) and I’d like to find a way to keep the positions of each nodes. My first thought was to save this information in the asset itself, but it seems like a bad idea because it’s data that won’t be used in the game, only in the node editor. I tried searching a solution but couldn’t find anything close to my problem.
For now I found a small “hack”, using the preprocessor #if UNITY_EDITOR in the ScriptableObject class used by my editor, but I think that the data will still be stored in the asset file within the game…

Any idea ?
Thanks.

As long as your scriptable object asset is not stored inside of any folder named Resources or StreamingAssets, it will not be included in your game. And instead of loading it using Resources.Load, use UnityEditor.AssetDatabase.LoadAsset instead.

Aither create an Asset for the data only, or save your node parameters in a data file on disk.

You can save data out of Assets/ folder , Try to use

AssetDataBase.Create(obj , "MyFolder/MyAssets/asset.asset") .

Bit of a necromancy, but just wrap the part you don’t want in the game with the preprocessor UNITY_EDITOR, as you already do. This includes the unwanted variable fields and all methods that reference said fields.

I wouldn’t say it’s a hack, that’s what this preprocessor is for. I actually do that for everything I don’t want referenced/used in the game. I even prefer this over using the Editor folder, since the game does not include unused scripts/assets in the build anyway.

It’s a better alternative to external assets because of import time (it takes a bit of processing) and since you have to reference them you’d have lingering references to your database in your assets. If you’re not careful you might even include them in your build. Unless you load the database every time you use it - then it’s a matter of inefficiency.