Now that we have the groundwork all placed and ready, let's get to the real meat of the level editor: saving and loading! Perform the following steps:
LevelEditorclass in your IDE. The first step will be to include some additional functionality at the beginning of our file:
//You must include these namespaces //to use BinaryFormatter using System; using System.Runtime.Serialization.Formatters.Binary; using System.IO;
private string levelName = "Level1";
GUILayout.BeginArea(new Rect(10, 20, 100, 100)); levelName = GUILayout.TextField(levelName); if (GUILayout.Button ("Save")) ...