Skip to main content

Snappable

A class in Root.Township, the global namespace.

Editor helper for level building: snaps the object's local rotation to fixed steps and lists child snap points named snap_.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private bool isSnappingRotationsWhether rotation snapping is on.
private float rotationSnapsRotation step in degrees.
private List<Transform> snapPointsBacking list for SnapPoints.

Properties​

MemberWhat it is
IEnumerable<Transform> SnapPoints { get; }The child transforms used as snap points.

Methods​

MemberWhat it is
void RefindSnapPoints()Rebuilds snapPoints from children whose name starts with snap_ (any case).
void SnapRotation()Rounds each local Euler angle to the nearest rotationSnaps step if enabled.
1 private and internal method
MemberWhat it is
private void OnValidate()Snaps the rotation when values change in the editor.