Life and Style Media - Flow Nest


A type that can be declared in any class. Instantiates a new embed background graph, and allows for selecting a predefined macro. Flow Nests can be manually trigger in the inspector.

FLOW NEST


Current Version: 1.0.1
Price: FREE
License: MIT
Type: C# Class








MANUAL


SETUP
When do I regenerate units?

- A units category has changed.
- A new unit or type is introduced.
- A unit or type is removed or marked obsolete.
- A unit or types namespace changed.
- A unit or types declaration has changed, including method signatures.

*If you are a C# programmer, you can alternatively use the attribute [RenamedFrom(string previousName)] and include the previous type name, including namespaces to prevent a regeneration.*

*Units, Graphs, Macros, ect, SHOULD NOT be included in the unit options window unless you need access to the internal scripts methods and variables.*


How do I regenerate units?

In the unity menu goto Tools > Bolt > Build Unit Options.



SUMMARY
Similar to the idea behind a System.Action (a variable that holds a reference to a method), this system does the same, but with Bolt Flow Graphs. A variable can either be an embed or a macro. It comes with a property drawer for ease of use, while even allowing for the graphs to be manually triggered during editor time.


DECLARING A FLOWNEST
Declaring a Flow Nest on a MonoBehavior, or ScriptableObject is easy, and will give you a property drawer. While also setting up your initialization code for itself, as you can see below:


public
FlowNest
nest =
new
FlowNest
();




There is a couple things to be aware of. First, in one specific case, in order to use in the editor and outside of playmode with a return method, you need to assign it during the editor. Either using OnValidate, or an Editor script of some sort.


public
FlowNest
nest =
new
FlowNest
();

private void
OnValidate()
{
    
if
(nest.returnMethod ==
null
) nest.returnMethod = ReturnSomething;
}

private object
ReturnSomething(
object
aInput)
{
    
var
outputValue = ((
int
)aInput) + 100;
    
Debug
.Log(outputValue);
    
return
outputValue;
}




FLOW NEST MACRO
To create a macro, you can find them in the Asset > Create > Bolt > Extensions > Flow Nest Macro.




When you create a Flow Nest Macro, an Entry unit is automatically added to the graph. The entry unit cannot be delete or manually created. When you select the entry unit, you will get the option to turn it into a coroutine, or set the input parameters.




USING RETURN METHODS
You know how to set it up now, so just add a Return unit (located in the root of the fuzzy finder), connect the output that will go through your method, and the flow to the control input. Then, Boom! You are all set to use it in your code.

(Returns are not necessary)




INVOKING THE GRAPH
All you need to do to invoke a graph is call Invoke(object[] parameters). We will do it in update like this.

private void
Update() {
    nest.Invoke(
new object
[] { "Jacob", 199 });
}