Customize Unity Editor Source Code

Hello! Does anyone know if it is in some way or the other possible to make changes to the Unity code infrastructure outside the official Unity development to create a customized workable version with certain functions added or removed from the original Unity workflow?

I find it very annoying that it is not possible to work on a running scene, make changes via the editor and not to be able to simply save all changes via “Save Scene”.

It would be a huge time saver to be able to have this option included as part of the workflow!

I think the official opinion that this option is disabled to avoid errors during work on a project is not completely thought through.

Regarding this information, it seems very unlikely that this option will be added to Unity in the future, so my question is if there is any possibility to modify a given Unity version to have this function enabled.

In general, why doesn’t Unity give a user the option to enable or disable this feature under Settings in the first place???

THX!

Nash

Not sure exactly what you are after. But a lot can be done with editor extensions. Many studios have custom workflows supported by extensions.

To remove the limitation that it’s not possible to save a scene when using the editor during a running scene. The Unity documentation States, that it’s disabled on purpose, to avoid faulty scene saves.

I think it’s a big time waster!

As a Unity user, I should be in the position to decided whether or not I want to save a scene while the editor is running the game.

As this is currently not possible I look for an option to remove this limitation, if it’s via a plugin or not.

Uh, I accidentally obliterated half of the objects in the world at least twice due to typo in a script running in a play mode. It is actually a good thing that by default changes aren’t saved. And if you accidentally saved changes to prefab, that could wreck your project badly. So it is a time saver.

Either way, I think there was an asset on the store for saving at runtime. I forgot what it was called. You should be able to implement your own serialization mechanism if you wanted - via editor extension, for example.

2 Likes

THX for your reply! And OK, I see your point! :wink:

Do you remember some keywords to narrow the search down for that plugin?

But my argument is that it should be on the user to enable / disable it for each workstep.

When you know it could harm your work in prefabs, you disable it. When others want to work on the graphic layout without limitations, they can enable it.

I had to spend a few hours on customizations via editing text values in the editor. The same job took me 30 minutes via drag and drop, but I couldn’t save the work then. I had to add all new values from the drag and drop work into a notes document, had to remember what where belongs to and then paste it back into the editor value boxes after exiting the preview mode.

From my standpoint it is very annoying and I think it is very much understandable why I think it’s annoying.

The problem is that majority of the easy-checkbox-click users do not understand when it can do harm to your scene. It could also mean hidden damage happens in your scene or objects and you notice it only much later and might even think it’s a bug and send a bug report. It’s much safer having no such option at all until it works safe with all workflows than have one and have it generate extra noise everywhere.

If you only need to save small tweaks to one component you can use component copy/paste. For your own risk there are assets that allow you to do per components, object or scene. Just look for play mode save, persist etc.

Why shouldn’t be there the option to choose how I want to work with Unity by default? Nevertheless people pay good hard dollars for the PRO version, so if there are many bug reports, it’s not the users’ problem, it’s one part of being a software developer to receive such. One other is to give the users the most possible variance of control options about how they can use the software.

Unity could educate people about the risks of having such editing mode enabled and everybody would be happy. :slight_smile:

THX to all for any information regarding certain plugins!!!

I consider this thread as solved unless someone has a direct link to such plugin, must not be a free Asset! :wink:

Nash

Yeah, I think giving Pro users at least partial access to source code would bring great value to it, aside of 100k thing (which should be IMO lowered to $75k or even $60k for Unity’s case now that all formerly Pro-only things are free) or splash/darkskin there’s not much sense in buying it now.

Found it:
https://www.assetstore.unity3d.com/en/#!/content/188

I haven’t ever needed or used the asset so I don’t know if it works as advertised or if it works at all.

Write an editor extension that can save/load values you’re customizing via json file. IIRC the extension will work in both play and edit modes, but it won’t be wrecking your scene permanently, so you’ll be able to save values in play mode and load them in edit mode.

For json serialization see JsonUtility script reference, and writing two buttons custom editor extension won’t be terribly hard.

One thing to keep in mind is that I had JsonUtility crash on me frequently in some rare circumstances. It is unlikely that you’ll need to be using it in the fashion I did, though.

1 Like

Saving a scene is play mode would be very problematic. Partially because how it works under the hood, but mostly because a scene is by definition the starting point. Things change in a scene once it starts. For example, you if you have a character, it starts at a certain place. You move it when the scene is playing. If you hit save, you would be saving its location now instead of where you start. It would completely make a mess of things. It is also something that if you access to source code, it would not be a simple fix, it is a safe bet that if you can’t find a solution to your problem via editor scripting, there is no way you would be able to handle the source code.

You have a few options if for some reason you need to make changes to certain things in while in play mode. First, you can store the data (either temporarily or permanently ) in a scriptable object. Values in an SO persist in either mode. A map editor is a good example. It is much easier to make a map editor in that runs in play mode instead of editor mode. Another option is to record things from the game to external data like a text file, or db or whatever. Finally, if it is just a matter of isolated data for individual scripts, you can use ExecuteInEditMode and have those scripts run in editor the same way they would run in play mode. The data is saved because you are in editor.

All users already do. The source for the UI is available, and they plan to open up more.

1 Like

I’ve meant like C++ side of things.

There is also the clipboard too, but that comes with the limitation of only being able to copy one thing at a time. I think I’ve heard of writing extensions to copy entire GO’s though.