Aego Playground

ScriptRef

node.GetScript<T>() returns the ScriptRef<T> of script T on that node, or nil when the node has none. On a nil or destroyed node it faults with AES6004. Use pkg.Name when the short name is ambiguous (AES2058).

Through a ScriptRef you can read and write fields (exported ones from other packages), call plain methods and connect to signals. Lifecycle methods and coroutines are not reachable (AES2059); call a plain method that does the work, or connect to a signal. A ScriptRef is re-validated on every access; once the target instance stops, access faults with AES6004. ScriptRef fields cannot be exported. A ScriptRef survives a hot reload of either side: fields and methods are re-resolved by name.