Skip to end of metadata
Go to start of metadata

Table of Contents


SGNode Initialization

Offload Initialization. Keep init() in the main scene and its static children as minimal as possible. Having too much "upfront" initialization will cause the channel to take a long time loading the main scene. Leave as much initialization as possible for the task thread function.

Data Flow

Copying Nodes: When copying nodes, do not simply call:

Setting nonexistent fields in a node will invoke additional internal verification and warning outputs to the debug console, causing UI lag. Instead, do something like:

ContentNode vs. Associative Arrays? Use ContentNode fields to represent complex trees of nested data that are expensive to copy, since they will be passed by reference. Use associative arrays to store small, shallow data structs. Associative arrays will be deep-copied through fields (pass-by-value) and has the advantage of keeping parallelization safer and more efficient.

Avoid onChange in Task Threads. If you'd like a Task node to execute a function in response to a field change, use the overloaded version of observeField() to send an roSGNodeEvent to your message port. Do this instead of setting onChange in the field you want to watch. While this is certainly not necessary, it might improve visual performance since onChange is usually executed on the render thread.

  • No labels