SensorBase
An abstract class for various sensor instance types.
| Memory category | Instances |
|---|
Member index 3
Description
A SensorBase is an instance that, when parented to a BasePart, outputs additional data about the world around that part. Often, other systems will consume the sensor's output data.
History 8
- 731 Change Default of UpdateType from to
- 726 Change Default of UpdateType from to
- 574 Change Tags of Sense from [] to [Deprecated]
- 573 Change ReturnType of Sense from void to null
- 565 Add OnSensorOutputChanged
- 565 Add Sense
- 565 Add UpdateType
- 565 Add SensorBase
Members 3
OnSensorOutputChanged
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
Fires when one of the sensor's output properties changes value. The event carries no arguments; read the relevant output property to get its new value.
A sensor only recomputes its outputs while UpdateType is SensorUpdateType.OnRead (the default), so with the default update type this event fires as the outputs are recalculated on read. When UpdateType is SensorUpdateType.Manual, the outputs — and therefore this event — change only when you set the output properties yourself.
| Thread safety | Unsafe |
|---|
History 1
Sense
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| null | ||
Recomputes the sensor's output properties immediately.
This method is deprecated and should not be used in new work. When UpdateType is SensorUpdateType.OnRead (the default), the sensor recalculates its output properties automatically the next time you read them, so calling this method is unnecessary. When UpdateType is SensorUpdateType.Manual, the outputs are never recomputed automatically; set the output properties yourself rather than calling this method.
| Thread safety | Unsafe |
|---|
UpdateType
| Type | Default | |
|---|---|---|
| SensorUpdateType | ||
Determines how the sensor will update its output data.
With SensorUpdateType.OnRead, internal sensor logic is run so that the output properties are always up to date. In this mode, the sensor will only run if you read the properties and they are currently outdated.
With SensorUpdateType.Manual, the output properties will never change. Instead, you can write your own scripts to set the output properties as you like.
| Thread safety | ReadSafe |
|---|---|
| Category | Settings |
| Loaded/Saved | true |
History 3
- 731 Change Default of UpdateType from to
- 726 Change Default of UpdateType from to
- 565 Add UpdateType