GameObject reference fields on Script Components (#75) #85
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/cinnabar#85
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#75
What to build
A field defaulted to the
GameObjectclass inComponent.definebecomes aGameObject_Referencefield. From Luau the field reads as the referenced GameObject userdata orniland accepts a GameObject ornilon write, going through the Reference Side Table rather than raw storage. A Scene Document stores the field as an Object Path and resolves it on load. An External Reference whose target Scene is unloaded reads asnil, the way the glossary says.Acceptance criteria
Component.define("x", { target = GameObject })registers a field with the.Referenceflagself.target = otherfrom Luau is visible viacomponent_reference; assigningnilclears itself.targetreturns a userdata that compares equal to the GameObject it was set tonilfrom Luau, and reads the GameObject once that Scene is loadedBlocked by