Lexicon starts off with the following entity binding types:
AnimationClip | Int | String |
AudioClip | Material | Texture |
Color | Prefab | |
Float | PrimitiveType |
If you would like to add another binding type, extend the LexiconEntity and LexiconEntityValue classes. Here is the Color entity as an example:
using System;
using UnityEngine;
namespace Mixspace.Lexicon
{
[CreateAssetMenu(menuName = "Lexicon/Entity/Color")]
public class ColorEntity : LexiconEntity
{
[SerializeField]
private ColorEntityValue[] values;
public override LexiconEntityValue[] Values
{
get { return values; }
}
}
[Serializable]
public class ColorEntityValue : LexiconEntityValue
{
[SerializeField]
private Color binding;
public override object Binding
{
get { return binding; }
}
public override void Initialize()
{
base.Initialize();
binding = Color.white;
}
}
}
You must have a field named values
in your LexiconEntity subclass and a field named binding
in your LexiconEntityValue subclass. Change the types to match your new binding. Update the Initialize method to work with your data type.
Be sure to change the CreateAssetMenu menuName to match your binding type. Now your entity type will show up when you choose Create > Lexicon > Entity.
Entity bindings cannot reference objects in a scene. Entities are assets and are not bound to a particular scene.