Hello there thanks for reading,
so yeah this is probably quite a beginner question since I only started using Unity very recently. I’ve worked with the c sharp scripting language before, so I’m not completely new to scripting.
Well now I’ve got a script set up on an empty gameobject in my scene in which I can change both several numeric values as strings for a custom editor I made that allows me to place 2d sprites in a tile-like manner. Things like: a String that holds a variable that defines the path where Unity would be able to fined prefab tiles for me to place them, several numeric values for like brush size and layerdepth… I can change these in the inspector of said gameobject and it manages to keep those while I’m editing my scene. But as soon as I try out my game by pressing the play game button I lose my static variable values…
I have the following in my script which is attached to my gameobject:
LevelLogic.tilePath = EditorGUILayout.TextField(“Tile Path”, LevelLogic.tilePath);
Where LevelLogic is a class with several other static variables I’d like to keep at all times. “tilePath” is a static variable in said class.
As I said it’s possible I’m just stupid and forgot something important, being a newbie at Unity as I am. I believe I can grasp why this is happening, but I don’t know how to look up this problem, sorry.
Extra:
-) I tried changing the LevelLogic class in a static one
-) the game object itself static in the Unity Editor