Creating a map editor to speed up map creation
Now, it is time to gather both configuration files – DefaultConfiguration (LevelConfiguration
) and Level01 (LevelData
) – and put them into use in a script that will initialize and place Prefabs based on the setup we made on each ScriptableObject. The script will be a component that can be attached to any GameObject in the scene and will need a couple of references to work: the LevelData
asset we want to use, and the plane used to place the Prefabs in the scene.
So, first, create a script called LevelComponent
inside the Scripts | Level folder. Then, open the script and replace the content with the following code:
using UnityEngine; namespace Dragoncraft { public class LevelComponent : MonoBehaviour { [SerializeField] private LevelData _levelData; [SerializeField] private GameObject...