Multiplatform Runtime Level Editor Documentation
If you have any questions or you cannot find any help for your problem in this documentation then please write a post in the following unity forum thread: Unity Forum: Multiplatform Runtime Level Editor. Please do the same also if you have any feedback or improvement suggestion to this documentation.
Error in console when clicking on 'Render Missing Icons' in an object map ("Failed to generate preview for object prefab '[XY]' at index '[Z]'!")
SOLUTION:
Click again
ERROR:
Level icon preview rendering does not work properly on Windows 8.1 and Windows Phone 8.1 when the resolution is not set to native.
SOLUTION:
This is a Unity bug that is easy to solve.
1. Open the "LE_GUIWindowRight.LevelTab.cs" file.
2. Search for "Level Icon Preview Bug"
3. Follow the instructions in the comments.
ERROR:
Level icon preview rendering does not work properly in Unity Editor (seen in Unity 5.2.2).
SOLUTION:
This is a Unity bug, that happens only in the editor and not in the build. This bug occurs only if you have (gray) borders in your game view in the Editor. If you need to render your level icons in the editor, then simply set the aspect ration to 'Free Aspect' in the game window. This bug is reported to be fixed in Unity 5.2.2, therefore if you have problems with it consider using a newer Unity version.
ERROR:
Code does not compile. With errors like:
"error CS0246: The type or namespace name `LE_LevelEditorMain' could not be found. Are you missing a using directive or an assembly reference?"
SOLUTION:
To avoid conflicts with your code all level editor classes have their own namespace. Add all namespaces by placing these lines at the top of your code file:
ERROR:
Unity console shows errors when project/scene is opened. "IsFinite(outDistanceAlongView) UnityEditor.DockArea:OnGUI()"
SOLUTION:
You are facing the Unity Engine bug which sets RectTransform values to NaN.
Unity Forum
Unity Issue Tracker
The MR Level Editor has a built in fix for this bug ('uMyGUI_ScrollbarHandleUnityFix'). The fix will be applied in the Awake function, therefore you should have no problems at runtime. However, if you feel annoyed by the errors, then you have to find the RectTrasnform with the NaN values and click on the 'FIX' button in the inspector of the uMyGUI_ScrollbarHandleUnityFix script, which is attached to all objects that are affected by this bug.
ERROR:
Saving works, but cannot load levels, because the level file is not found.
SOLUTION:
I was not able to reproduce this, but it was reported. Maybe it happens on certain OS configurations. If you encounter this bug open the ExampleGame_LoadSave.cs file. The script is very easy and consists of only 75 lines. The line
WWW www = new WWW("file://" + Application.persistentDataPath + "/level.txt");
tells where the system has to search for the level file. Since this is an example anyway and you will probably want to change it, try to use "Application.dataPath" instead of "Application.persistentDataPath" it solved the problem for the bug reporter.
Thanks for reporting this issue to Prophet (working on Martial Law)
ERROR:
Only in v1.01: Error in console when creating a terrain ("A game object can only be in one layer. The layer needs to be in the range [0...31]").
Since v1.10: you do not need to change anything in your project. However, you will see a warning with instructions as long as you have no "Terrain" layer added. I will keep this warning to make sure that the terrain is not placed in any of your layers that have a special handling. If you do not use layers at all you can safely ignore these warnings. SOLUTION:
Add "Terrain" layer to the layer list of your project.
Introduction
-
Event Interface
The MR Level Editor has an event based interface that allows to integrate the editor easily in any game.
This is the starting point of the documentation, please read this article first. -
Configuration
Once integrated the MR Level Editor has a simple configuration workflow.
You can quickly setup all parameters like terrain textures&brushes, objects, gizmos, etc. in the inspector.
Tutorials & How To's
Save & Load / Serialization-
Save Level
Learn how to save your level to a byte array. -
Load Level
Learn how to load your level from a byte array and how to get the level file version, all level objects or the terrain without searching. -
Add Additional Meta Data
By default level meta data contains only the level icon. Learn how to add additional meta data to your levels. -
MRLE Extension - Save/Load file picker
Save and load multiple level files with the file picker extension.
-
Add/Remove/Modify/Limit Terrain Textures
Learn how to add your own terrain textures and remove or modify the existing ones. It is possible to limit the number of textures per level. Also the base texture selection can be disabled. -
Add/Remove/Modify Terrain Brushes
Learn how to add your own terrain brush masks and remove or modify the existing ones. -
Use A Custom Unity Terrain
Learn how to use a custom terrain made with Unity and skip the terrain creation UI.
-
Create/Add/Remove Level Objects
Learn how to create and add your own level objects or how to remove the existing ones. -
Define/Limit Level Objects Placement Area
Learn how to define or limit the area where level objects can be placed or built. -
Perform Actions After Level Object Placement
Learn how to perform actions after level object placement. For example limit the maximal count of objects or make objects cost ingame money. -
Object Snap Modes
Learn how to make an object snap to a terrain or to a grid. Additionally, objects can also snap to certain points of other objects. -
Streamed Levels/Streamed Objects/Late Load Objects
Learn how to improve performance of big levels by setting level objects to be instantiated only if visible.
-
Use A Custom UI
An example UI is included. Learn how to replace it with a custom UI created with uGUI, NGUI or even OnGUI. The editor is independent of the UI implementation. -
Add A Button To The Level Tab
The included example UI has three buttons (save&load&play). Learn how to extend the editor with additional buttons in the level tab. -
Add Left Menu/Manage Left Menu Buttons
The included example UI has a menu. Learn how to add additional buttons to it. -
Add Help Topic
Learn how to add a help topic to the help popup. -
Hide(Remove) Terrain/Object Tabs
Learn how to hide or remove the terrain or the object tab of the editor.
Troubleshooting
ERROR:Error in console when clicking on 'Render Missing Icons' in an object map ("Failed to generate preview for object prefab '[XY]' at index '[Z]'!")
SOLUTION:
Click again
ERROR:
Level icon preview rendering does not work properly on Windows 8.1 and Windows Phone 8.1 when the resolution is not set to native.
SOLUTION:
This is a Unity bug that is easy to solve.
1. Open the "LE_GUIWindowRight.LevelTab.cs" file.
2. Search for "Level Icon Preview Bug"
3. Follow the instructions in the comments.
ERROR:
Level icon preview rendering does not work properly in Unity Editor (seen in Unity 5.2.2).
SOLUTION:
This is a Unity bug, that happens only in the editor and not in the build. This bug occurs only if you have (gray) borders in your game view in the Editor. If you need to render your level icons in the editor, then simply set the aspect ration to 'Free Aspect' in the game window. This bug is reported to be fixed in Unity 5.2.2, therefore if you have problems with it consider using a newer Unity version.
ERROR:
Code does not compile. With errors like:
"error CS0246: The type or namespace name `LE_LevelEditorMain' could not be found. Are you missing a using directive or an assembly reference?"
SOLUTION:
To avoid conflicts with your code all level editor classes have their own namespace. Add all namespaces by placing these lines at the top of your code file:
using LE_LevelEditor;
using LE_LevelEditor.Core;
using LE_LevelEditor.Events;
using LE_LevelEditor.Example;
using LE_LevelEditor.LEInput;
using LE_LevelEditor.Logic;"
using LE_LevelEditor.UI;
ERROR:
Unity console shows errors when project/scene is opened. "IsFinite(outDistanceAlongView) UnityEditor.DockArea:OnGUI()"
SOLUTION:
You are facing the Unity Engine bug which sets RectTransform values to NaN.
Unity Forum
Unity Issue Tracker
The MR Level Editor has a built in fix for this bug ('uMyGUI_ScrollbarHandleUnityFix'). The fix will be applied in the Awake function, therefore you should have no problems at runtime. However, if you feel annoyed by the errors, then you have to find the RectTrasnform with the NaN values and click on the 'FIX' button in the inspector of the uMyGUI_ScrollbarHandleUnityFix script, which is attached to all objects that are affected by this bug.
ERROR:
Saving works, but cannot load levels, because the level file is not found.
SOLUTION:
I was not able to reproduce this, but it was reported. Maybe it happens on certain OS configurations. If you encounter this bug open the ExampleGame_LoadSave.cs file. The script is very easy and consists of only 75 lines. The line
WWW www = new WWW("file://" + Application.persistentDataPath + "/level.txt");
tells where the system has to search for the level file. Since this is an example anyway and you will probably want to change it, try to use "Application.dataPath" instead of "Application.persistentDataPath" it solved the problem for the bug reporter.
Thanks for reporting this issue to Prophet (working on Martial Law)
ERROR:
Only in v1.01: Error in console when creating a terrain ("A game object can only be in one layer. The layer needs to be in the range [0...31]").
Since v1.10: you do not need to change anything in your project. However, you will see a warning with instructions as long as you have no "Terrain" layer added. I will keep this warning to make sure that the terrain is not placed in any of your layers that have a special handling. If you do not use layers at all you can safely ignore these warnings. SOLUTION:
Add "Terrain" layer to the layer list of your project.