Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Advanced, but simple to use, runtime level editor for Unity.

License

Notifications You must be signed in to change notification settings

Hertzole/advanced-level-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced Level Editor (ALE)

tests build dev package release package

ALE IS IN VERY EARLY DEVELOPMENT! ANYTHING CAN CHANGE SUDDENLY! USE AT YOUR OWN RISK

Built level editor Image is what ALE currently looks like. Will get periodically updated along with ALE. Keep in mind everything is a work in progress!

❓ What is it?

ALE is a runtime level editor for Unity that aims to be simple to use both for the user and the developer. It's built with performance and usability in mind. It should also be extendable so you can adapt it to fit just right for your game.

ALE works on a "editor mode system" where each mode does it's own thing and you switch between them. Right now there is only the (very much WIP!) unified mode that tries to replicate Unity. You can create your own modes and add them as components on the level editor and the mode will just work.

ALE also does some "magic" for you to simplify your life. It uses Mono.Cecil to do some code weaving and inject code into your assemblies to automate your workflow. This means it will be very performant since you can do stuff like exposing properties without reflection (which can be rather slow)! It also means that, in theory, ALE should work on ALL platforms, Mono and IL2CPP!

✨ The magic

As mentioned above, ALE does some "magic" for you. I've tried to avoid reflection as much as possible since it can be rather slow and instead opted to generate code during compile time, IL weaving if you will. The best example of this is the ExposeToLevelEditor attribute that injects IExposeToLevelEditor in your scripts.
In the future, the same will magic will be applied to much more. It's coming eventually™.

✅ TODO List

ALE is still in EARLY development. There's still a lot to do and it's nowhere close to finish. But it should be useable now. Anyways, here are some things that I need to do and the things that are finished.

Required

What needs to be done before 1.0.0 verified.

  • Binary serialization and deserialization
  • JSON serialization and deserialization (see note)
  • Unified serializer for binary and JSON
  • Editor camera
  • Full 2D support
  • Full 3D support
  • Input System support
  • Undo and redo
  • Hierarchy
  • Hierarchy customization
  • Inspector
  • Custom component fields
  • Resource browser
  • Resource browser customization
  • Level editor gizmos
  • Play mode
  • Save all exposed values in play mode
  • Auto serialize unknown types³
  • Auto expose unknown types
  • Integrate custom serializers
  • Menu items
  • Add component menus
  • Fast enter play mode support
  • Custom component wrappers
  • Serialize arrays¹
  • Serialize lists¹
  • Serialize dictionary²
  • Resource limit support

Optional

What would be really nice to have before 1.0.0 verified.

  • Orientation gizmos
  • Scene grid
  • Manipulation handles
  • Adaptive editor GUI
  • Tilemap integration
  • ProBuilder integration
  • Multiselection support
  • More errors and visuals to tell when something is wrong
  • Custom component UGUI
  • Unity mathematics support
  • XML documentation in code

Inspector fields

The supported inspector fields.

  • Number fields
  • Text fields
  • Toggle field
  • Vector2(int) field
  • Vector3(int) field
  • Vector4/Quaternion field
  • Object reference field
  • Resource reference field
  • Color field
  • Array field
  • Nested classes/structs
  • Enum field

¹ Doesn't work 100% with Unity objects yet. May appear to work during runtime but most likely won't work in build!
² While technically it will serialize dictionaries, it won't serialize exposed field dictionaries.
³ It will automatically serialize structs but not classes.

📦 Installation

See the documentation for installation.

🔨 Getting Started

DOCUMENTATION IS VERY SPARSE RIGHT NOW AND WILL PROBABLY REMAIN SO FOR QUITE A WHILE

Setup a level editor

If you've installed it through the package manager, I recommend importing the "Complete" sample and start modifying that.

//TODO: Finish setup guide
Start by creating an empty object and add the Level Editor component. Then assign the required fields.

Expose a field to the level editor

To expose a field or property to the level editor, you simply do

[ExposeToLevelEditor(0)]
public float myField;
[ExposeToLevelEditor(1)]
public string MyProperty { get; set; }

NOTICE! The IDs need to be unique and they are used for saving levels and fetching values! You should not change these after creating your exposed field!

Draw level editor gizmos

You can draw gizmos at runtime in the level editor very easily using interfaces.

public class MyScript : MonoBehaviour, ILevelEditorGizmos, ILevelEditorSelectedGizmos
{
	// Always drawing
    public void DrawLevelEditorGizmos(ILevelEditorGizmosDrawer drawer)
    {
        // Start, end, color
        drawer.DrawLine(Vector3.zero, Vector3.one, Color.red);
        // Center, size, rotation, color
        drawer.DrawWireCube(Vector3.zero, Vector3.one, new Vector3(0, 45, 0), Color.magenta);
    }
	
	// Only drawing when selected
	public void DrawLevelEditorGizmosSelected(ILevelEditorGizmosDrawer drawer)
	{
		// Center, size, rotation, color
		drawer.DrawSquare(Vector3.zero, new Vector2(1, 1), Quaternion.identity, Color.blue);
	}
}

📃 License

ALE itself is licensed under MIT. However, it contains some code that is under Unity's own license. As long as you use ALE within Unity, you're good to go.

❤ Credits

yasirkula - Dynamic Panels for Unity3D for panels
yasirkula - Runtime Inspector & Hierarchy for Unity 3D for tree control
Unity Technologies/ProBuilder team - GILES for editor camera
judah4 - HSV Color Picker for color picker
Mirage team - Lots of weaving code from Mirage
paulpach - Helped me with weaver related questions
Yoshifumi Kawai - MessagePack for C# for serialization
HiddenMonk - Unity3DRuntimeTransformGizmo for runtime handles

❤ Developed with love and support from Aurora Punks

About

Advanced, but simple to use, runtime level editor for Unity.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published