Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Levels System

pointcache edited this page Jan 16, 2017 · 5 revisions

URSA has a system that allows you to store some data with your scene. Example would be your "entry points" to the level, which with this system will be accessible from outside the scene, project wide. This also allows you to add any additional info you need.

(this system is currently partially migrated)

This functionality is implemented through SceneData scriptableObject and SceneDataCollector scriptable object.

SceneData is a POD that can be modified to hold whatever data you need. SceneDataCollector is a POD that holds all your scene data objects and allows you to retrieve linked scene data by scene name or other means.

##Usage

  1. Select your scene
  2. Use special menu

This will create default scene data object.

##Customize SceneData creation:

  • Add your own custom fields to SceneData
  • Create a static editor class that will hold your callback, in it's constructor register the callback in LevelsSystemEditor.OnSceneDataCreated
[InitializeOnLoad]
public static class MySceneDataCreator  {

    static MySceneDataCreator() {
        LevelsSystemEditor.OnSceneDataCreated += CustomSceneDataCreator;
    }

    static void CustomSceneDataCreator(SceneAsset scene, SceneData data) {
        data.creationDate = DateTime.Now;
    }
}

#Customize SceneData collection

When you use URSAMenu> Levels/CollectSceneData Levels system will scan assets for all SceneData files, assign unique ids used to perform searches, will collect additional context and just before saving it will raise event

OnSceneDataCollected ( SceneData )

This gives you the SceneData linked to currently opened scene, in which you can collect any data from opened scene and store it for runtime use.

Clone this wiki locally