Change code at runtime

Does unity have some kind of debug tool? Or when I run the game, change some code, and the game will continue with changes I made WITHOUT resetting all variables and breaking the game.

I know it has to be compiled first, but I`m just asking :smiley:

Visual Studio preferably.

@Wrymnn As far as I know unity doesn’t have such tool. But unity is build to work that way. Meaning you can change the code while runtime, save(Ctrl+s), wait to compile, and then unity will reinit variables. Unity will reinit ONLY serialized variables, marked as PUBLIC or [SerializeField]. Unity won’t init runtime created and init variables or objects. So you need to have custom code which will handle DidReloadScript callback and init those. See in practices urself.

 [UnityEditor.Callbacks.DidReloadScripts]
        private static void OnScriptsReloaded() {

          //custom init here
        }

May be this tool will help you?
http://unityvs.com/ we use it.

You can use scriptableObjects to have is so you can change data, swap out data and functions all while game is running and changes are persistent, but I don’t think you can change the code live right now, I think that is something they are working on tho.