Skip to main content

Test

A class in Root.Township, Alta.PAGaC.

Test asset for PAGaC: a hand-filled 3D tag grid plus an option set, used to try out part placement.

Constructors​

MemberWhat it is
Test()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

6 private and internal fields
MemberWhat it is
private OptionSet optionSetThe parts to try placing.
private Tag[] serializedTagsFlat copy of the grid that Unity saves.
private int sizeXBacking field for SizeX.
private int sizeYBacking field for SizeY.
private int sizeZBacking field for SizeZ.
private Tag[,,] tagsThe 3D tag grid.

Properties​

MemberWhat it is
Tag this[int x, int y, int z] { get; }Indexer: the tag at a grid cell.
int SizeX { get; }Grid width.
int SizeY { get; }Grid height.
int SizeZ { get; }Grid depth.

Methods​

MemberWhat it is
void ForceBeforeSerialize()Runs the serialization callback by hand to flatten the grid into serializedTags.
GameObject Generate()Runs a Constructor on the grid and returns the spawned parts under a new object.
5 private and internal methods
MemberWhat it is
private void UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()Rebuilds the 3D grid from the flat serializedTags array.
private void UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize()Flattens the 3D grid into serializedTags.
private void OnValidate()Resizes the grid when the size fields change in the inspector.
private void RecreateTags()Replaces the grid with a new empty one at the current size, losing its contents.
private void Resize()Recreates the grid if it is missing or its size no longer matches.