Skip to content

Instantly share code, notes, and snippets.

@kurtdekker
Created February 24, 2022 17:11
Show Gist options
  • Save kurtdekker/5be8100f70a2a4335b2f574da7595c87 to your computer and use it in GitHub Desktop.
Save kurtdekker/5be8100f70a2a4335b2f574da7595c87 to your computer and use it in GitHub Desktop.
Example ScriptableObject-based LevelDefinition object
using UnityEngine;
// @kurtdekker
//
// An example "level definition" object.
//
// The purpose is to centralize all the things you need to
// present, select and launch a given level.
//
// To use:
// - right-click-create one of these for each level in your game
// - fill the fields out in the inspector
// - drag them into a list and use them as the basis for what you can select
[CreateAssetMenu]
public class LevelDefinition : ScriptableObject
{
public string Description;
public Texture2D ThumbnailTexture;
// OR: (might be more useful)
public Sprite ThumbnailSprite;
// you could make this an array of additively-loaded Scenes too
public string SceneName;
// TODO: other defining things about this level here?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment