This is an in-engine scene editor that I’d like to showcase that I am quite proud of. I have been very inspired of the editor from Unity and its workflow. This was my attempt at replicating it.
Please note that most stuff below is minimum viable product and has not been polished.
BASIC SCENE HANDLING
The follow is simply the basic stuff all editors are expected to have.
- Create new scenes
- Open scenes
- Save scenes
- Recent scenes
- Fun random welcoming message each startup 🙂
A quite polished asset browser that supports the following:
- Searching files explicitly
- Searching files implicitly by pressing a key to select the file in current directory.
- Drag and drop files into inspector and where ever else.
- Create new materials, shaders, curves, scripts.
- Saves previous directory after editor restart.
- Multiple asset browsers at the same time to maximum efficiency.
Something I later on realized was that it took a lot of performance due to iterating the directory each frame which was solved by caching the results and only updating it once I received a notification that something changed from Windows.
Must alike Unity’s Inspector which allows for adding and removing components. Modifying exposed values and using it like a debug tool to live see the values of variables.
A programmer can expose component variables using the reflection system.
Its not fun to poke around in JSON, therefore a way to edit materials were in order. We are able to add shaders and its render states with support add multiple passes.
To interact with the shaders we can also create variables.
This was initially written very early on my own time (because of curiousity) during Project 3 and has later on been ported over to the editor because it is very usable for animations, particles and much more.
As with most stuff its very inspired by Unity’s Animation Curve.
CLONE-BASED PLAY/EDIT MODE
Internally there are one scene within the editor which is static and unchanged.
When entering playmode, the static scene is cloned from memory to create the runtime scene which is live.
Changes made to the runtime scene while in playmode, will not affect the static scene.
An easier way to do this would be to simply load the scene from disk again, but that is not performant enough for me.
- Create, delete new gameobjects
- Copy & Paste gameobjects
- Multi selection using Ctrl or Shift.
- Dragging and dropping to order around and change child/parent relationship.
The goal was to replicate the prefabs from Unity that automatically updates all other instances of that same prefab in all other scenes with support to override default prefab values per instance.
This was a difficult task using our reflection system because even though the reflection system is powerful, it was not that powerful to easily implement such a feature.
It also support instantiating prefab gameobject in runtime from code.
- Automatically updates instances of this prefab in all scenes
- Can modify values in each prefab instance to override the default prefab value
- Any changes to the prefab will be mirrored for the prefab instances unless that specific property had been overriden.
- Runtime instantiation of prefabs
- Full syncing of gameobject hierarchy, components and properties.
- Ability visualize what values/components has been overriden in a specific prefab instance.
The serialization and deserialization is based upon our reflection system which you can read more about here.
In short, any variables that programmer expose and automatically serialized and deserialized. As well as exposed in the inspector, and visual script nodes automatically generated for it.
The only line of code a programmer has to write to expose a variable is the following.
We were given a visual scripting system by our teacher that we have continued to improve upon. It has been integrated into the editor and engine and work seemlessly together.
As well as editing the live instance to see changes live in runtime while in play mode.
ANIMATION STATE MACHINE EDITOR
I have also written an animation machine editor that you can read more about here.