ObjectHistory
A class in Root.Township, Alta.Populations.
Debug component that records an object's position and rotation every Update, FixedUpdate and LateUpdate into a ring buffer and draws them as gizmos.
- Listed in World generation
- Inherits or implements
MonoBehaviour - Nested types
ObjectSnapshot,ObjectTrackingSettings,SnapshotType
Constructors
| Member | What it is |
|---|---|
ObjectHistory() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private int currentIndex | Next slot to write in the ring buffer. |
private ObjectHistory.SnapshotType gizmosToShow | Which snapshot kinds to draw. |
private bool isClearing | Inspector Clear button. Nothing reads it in this build. |
private NetworkRigidbody networkRigidbody | The tracked object's NetworkRigidbody, if any. |
private ObjectHistory.ObjectSnapshot[] objectHistory | The ring buffer of snapshots. |
private Transform objectToTrack | The transform being recorded. |
private float positionGizmoSize | Radius of each snapshot sphere. |
private ObjectHistory.ObjectTrackingSettings settings | Which update loops to record in and the buffer size. |
Methods
| Member | What it is |
|---|---|
static ObjectHistory TrackObject(Transform target, ObjectHistory.ObjectTrackingSettings settings) | Adds an ObjectHistory to the target and starts tracking it with the given settings. |
8 private and internal methods
| Member | What it is |
|---|---|
private void AddObjectSnapshot(ObjectHistory.ObjectSnapshot snapshot) | Writes a snapshot into the ring buffer, overwriting the oldest once full. |
private void CaptureNetworkRigidbody() | Records the tracked NetworkRigidbody's networked position and rotation. |
private void FixedUpdate() | Records a snapshot if fixed update tracking is on. |
private void LateUpdate() | Records a snapshot if late update tracking is on. |
private void OnDrawGizmosSelected() | Draws a sphere and forward ray for each snapshot of the chosen kinds. Probably throws until the buffer is full, since empty slots are null. |
private void RecordObject(ObjectHistory.SnapshotType updateMethod) | Records the tracked transform's current position and rotation. |
private void Start() | Allocates the buffer and finds the NetworkRigidbody if that tracking is on. |
private void Update() | Records a snapshot, and when network rigidbody tracking is on adds another Socket.EndOfReceival handler every frame (never removed). |