Skip to main content

SplineDisplay

An abstract class in Root.Township, Alta.Bezier.

Base for something built along a parent BezierSpline (a mesh, fence and so on). It rebuilds when the spline changes and can be baked to remove itself.

Constructors​

MemberWhat it is
protected SplineDisplay()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected bool isGeneratedTrue once it has been built.
2 private and internal fields
MemberWhat it is
private bool isUpdatingWhether the display regenerates when its spline changes.
private BezierSpline splineBacking field for Spline, filled from the parent BezierSpline on first use.

Properties​

MemberWhat it is
bool IsBaked { get; set; }True once baked.
BezierSpline Spline { get; }The spline in the parents, found on first use.
protected virtual bool IsHeadlessOnly { get; }Despite the name, true means it is skipped on a headless server. True by default.
protected bool IsPrefab { get; }Always false in this build.

Methods​

MemberWhat it is
void Bake()Builds once, then destroys this component so only the result stays.
void Generate()Builds the display.
virtual void OnValidate()Editor hook. Empty here.
protected abstract void GenerateInternal()Subclass: does the building.
protected virtual void Start()Builds once and starts listening to spline changes, unless skipped on headless.
protected virtual void Update()Empty here.
1 private and internal method
MemberWhat it is
private void SplineChanged(BezierSpline spline)Handler for the spline's Changed event; regenerates if isUpdating is on, or unsubscribes if the spline no longer belongs to it.