Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

editTrait

editTrait<S>(writer, target, trait): EditedRecord<Trait<S>>

target’s record of trait, to change in place while its writer writes: until the system that took it returns, or until a view’s or a setup’s writer closes. A factory trait’s own record, and for a trait of fields an editor whose fields read and write the record, bound to target until the next editTrait of the same trait. For a large record, or a value such as a vector changed in place, with no copy and no allocation. It tells no watcher of the trait: setTrait does. The writer is as setTrait’s. As Unity’s SystemAPI.GetComponentRW.

Type Parameter
S extends Schema
Parameter Type
writer EntityAuthority | PredictedStep
target PredictedEntity
trait PredictedTrait<S>

EditedRecord<Trait<S>>

editTrait<T>(writer, target, trait): EditedRecord<T>

target’s record of trait, to change in place while its writer writes: until the system that took it returns, or until a view’s or a setup’s writer closes. A factory trait’s own record, and for a trait of fields an editor whose fields read and write the record, bound to target until the next editTrait of the same trait. For a large record, or a value such as a vector changed in place, with no copy and no allocation. It tells no watcher of the trait: setTrait does. The writer is as setTrait’s. As Unity’s SystemAPI.GetComponentRW.

Type Parameter
T extends UnstreamedTrait
Parameter Type
writer EntityAuthority | SystemStep
target Target
trait T

EditedRecord<T>

editTrait<T>(writer, target, trait): EditedRecord<T>

target’s record of trait, to change in place while its writer writes: until the system that took it returns, or until a view’s or a setup’s writer closes. A factory trait’s own record, and for a trait of fields an editor whose fields read and write the record, bound to target until the next editTrait of the same trait. For a large record, or a value such as a vector changed in place, with no copy and no allocation. It tells no watcher of the trait: setTrait does. The writer is as setTrait’s. As Unity’s SystemAPI.GetComponentRW.

Type Parameter
T extends AnyEntityPredictedTrait
Parameter Type
writer PredictedStep
target PredictedEntity
trait T

EditedRecord<T>

editTrait<T>(writer, target, trait): EditedRecord<T>

target’s record of trait, to change in place while its writer writes: until the system that took it returns, or until a view’s or a setup’s writer closes. A factory trait’s own record, and for a trait of fields an editor whose fields read and write the record, bound to target until the next editTrait of the same trait. For a large record, or a value such as a vector changed in place, with no copy and no allocation. It tells no watcher of the trait: setTrait does. The writer is as setTrait’s. As Unity’s SystemAPI.GetComponentRW.

Type Parameter
T extends Trait
Parameter Type
writer EntityAuthority
target Entity
trait T

EditedRecord<T>

editTrait<T>(writer, target, trait): EditedRecord<T>

target’s record of trait, to change in place while its writer writes: until the system that took it returns, or until a view’s or a setup’s writer closes. A factory trait’s own record, and for a trait of fields an editor whose fields read and write the record, bound to target until the next editTrait of the same trait. For a large record, or a value such as a vector changed in place, with no copy and no allocation. It tells no watcher of the trait: setTrait does. The writer is as setTrait’s. As Unity’s SystemAPI.GetComponentRW.

Type Parameter
T extends Trait
Parameter Type
writer Authority
target World
trait T

EditedRecord<T>

editTrait<T>(writer, target, trait): EditedRecord<T>

target’s record of trait, to change in place while its writer writes: until the system that took it returns, or until a view’s or a setup’s writer closes. A factory trait’s own record, and for a trait of fields an editor whose fields read and write the record, bound to target until the next editTrait of the same trait. For a large record, or a value such as a vector changed in place, with no copy and no allocation. It tells no watcher of the trait: setTrait does. The writer is as setTrait’s. As Unity’s SystemAPI.GetComponentRW.

Type Parameter
T extends Trait
Parameter Type
writer SetupWriter
target Target
trait T

EditedRecord<T>

editTrait<T>(writer, target, trait): EditedRecord<T>

target’s record of trait, to change in place while its writer writes: until the system that took it returns, or until a view’s or a setup’s writer closes. A factory trait’s own record, and for a trait of fields an editor whose fields read and write the record, bound to target until the next editTrait of the same trait. For a large record, or a value such as a vector changed in place, with no copy and no allocation. It tells no watcher of the trait: setTrait does. The writer is as setTrait’s. As Unity’s SystemAPI.GetComponentRW.

Type Parameter
T extends LocalTrait
Parameter Type
writer ViewWriter | EntityAuthority | SystemStep
target Target
trait T

EditedRecord<T>