How To Use Dynamic Variables

From Resonite Wiki
Revision as of 09:42, 17 July 2024 by AmasterAmaster (talk | contribs) (This page is no longer a stub (but feel free to edit and add more dynamic sections for tutorials on dynamic variables).)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

As the Dynamic Variables page itself is quite information dense, this tutorial will serve as a quick guide to create, write and read these variables and components, and is also designed to get you started immediately with them, in a step by step process. This should also be simpler to understand in comparison to the main page.

Since you can use dynamic variables in many different configurations, this tutorial will be split up based on what your needs and requirements are.


Triggers & Receivers

Use this when you just want to send a signal across different code groups (and also sometimes with data)

What You Need

Setup

An example of the trigger and receiver nodes.
An example of the trigger and receiver nodes.
  1. Spawn both Dynamic Impulse Trigger & Dynamic Impulse Receiver nodes with the ProtoFlux Tool.
  2. Add a tag for both nodes to send and listen for. We are using Example for both nodes.
  3. Add a Slot hierarchy for the trigger node.
It is currently bad practice to use the Root Slot node, but using this will allow us to see if these nodes can send some signal for testing purposes.

Dynamic Input Variables & Dynamic Spaces

Use this when you have a value that can be grabbed and used anywhere.

What You Need

Setup

An example of using the Dynamic Variable Input node.
An example of using the Dynamic Variable Input node.
  1. Spawn any Slot to use as your space (the example uses a box), then set up the DynamicVariableSpace component on your slot.
    1. Pick a name for this space. (The example uses Example)
  2. Spawn the Dynamic Variable Input node.
    1. Setup the name for this node. (The example uses Example/MyBox)
  3. Make a child object of that slot, then add the DynamicValueVariable or DynamicReferenceVariable component. (The exmaple uses DynamicReferenceVariable)
    1. Setup the name for this component. (The example uses Example/MyBox)
  4. Pack the Dynamic Variable Input node under the child slot (or anywhere under the slot that has the DynamicVariableSpace), and it should work. (The example uses Red Print to do this.)

Dynamic Read And Write Variables & Dynamic Spaces

Use this when you have component values you want to dynamically read and write from anywhere.

What You Need

Setup

An example of using the Dynamic Variable Read and Write nodes.
An example of using the Dynamic Variable Read and Write nodes.
  1. Spawn any Slot to use as your space (the example uses a box), then set up the DynamicVariableSpace component on your slot.
    1. Pick a name for this space. (The example uses Example)
  2. Spawn the Read Dynamic Variable or Write Dynamic Variable node.
    1. Setup the path for this node. (The example uses Example/MyBox)
    2. Attach a slot hierarchy to check through. (This example uses the box itself that has the space)
  3. Make a child object of that slot, then add the DynamicValueVariable or DynamicReferenceVariable component. (The exmaple uses DynamicReferenceVariable)
    1. Setup the name for this component. (The example uses Example/MyBox)
  4. The nodes Do Not need to be under the slot that has the space to work. (The example uses Red Print to show this example.)