Closed benzsuankularb closed 2 years ago
I want to use an array, map other reference types as a field in a component.
Which I think I should use @field.ref.
@field.ref
However, want to know a bit more about its behavior.
@component export class MyComponent { @field.ref declare indexes: {[key: string]: Entity}; }
let myComp = entity.write(MyComponent); myComp["newItem"] = entity2; myComp.indexes = myComp.indexes; // Mark the component as changed?
2. Will I going cause the problem with multi-threading by multiple systems trying to access and modify these ref type fields or referenced Entity?
We chatted about this on Discord: https://discord.com/channels/654487419407826945/821272559634481152/908375726535897108
I want to use an array, map other reference types as a field in a component.
Which I think I should use
@field.ref
.However, want to know a bit more about its behavior.
let myComp = entity.write(MyComponent); myComp["newItem"] = entity2; myComp.indexes = myComp.indexes; // Mark the component as changed?