Info
- Serializable helper types for inspector fields
- Module
Polis.Core.DataStructures, time types in Polis.Core.TimeHandling (Time/)
Values
VariableField<T> - a value whose source is chosen in the inspector, read .Value
RawVariableFieldData<T> - plain value (default)
ScriptableVariableFieldData<T> - from an AScriptableVariable<T>
ConditionalVariableFieldData<T> - one of two values by a condition
TransformPositionVariableFieldData - position of a transform
LocalizedStringVariableFieldData - localized string
ColorVisualPresetFieldData - color from a visual preset source, e.g. the UI style
ColorPaletteFieldData - color from a ColorPalette
ToggleableField<T> - value with a checkbox (State)
- Implicit cast to
T
ToValueList() returns only the checked values
- Used for defines and scenes in Build Tool configs
PlatformSpecificValue<T> - default value with per platform overrides, GetCurrentPlatformValue()
[SerializeField]
private VariableField<float> _Speed = new(1f);
[SerializeField]
private PlatformSpecificValue<int> _MaxPlayers;
var speed = _Speed.Value;
var max = _MaxPlayers.GetCurrentPlatformValue();
References
SerializedInterface<TInterface> - a Unity object reference typed as an interface, .Value or implicit cast
SceneField - scene picker that keeps Name, Path and BuildIndex
UType - serializable System.Type, implicit to and from Type
Identifiers
UGuid - serializable GUID
UGuid.New(), Parse, TryParse, Empty
- Implicit to and from
System.Guid
- Own drawer, validator and JSON converter
Collections
SerializableDictionary<TKey, TValue> - Unity serializable IDictionary with a JSON converter, implicit to and from Dictionary (Polis.Core.Utils.SerializableDictionary)
Serializable2DArray<T> - serializable 2D array
PrefabList<TItem, TView> - one prefab instance per item under a container, for lists built from code (window buttons, players, stream rows, decals). In Polis.Core.NativeUtils, not serialized
Sync(items) keeps the views of items that stay, so their state doesn't restart, creates new ones and destroys the rest
- Constructor takes the prefab, container,
setup (once per new view), refresh (every view after each change) and an optional key
- Also
Add, Remove, Clear, TryGetView, Views, FirstSiblingIndex (keeps authored children in front)
_buttons = new PrefabList<WindowDefinition, WindowButton>(_ButtonPrefab, _Container, SetupButton);
_buttons.Sync(definitions);
Time