Can I do FlowGraph<T>?

Andreas Scherren 4 years ago updated by Nilson 4 years ago 8

Can I set "Type" as Input Type for GetComponent and AddComponent (field "ComponentType") and say that the type of the Output's "Component"-field is of type "ComponentType" ?

Aka: LineRenderer lineRenderer = RequireComponent<LineRenderer>(); ?

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Somehow picture upload doesn't work. So here the screenshot via Imgur: 

(I currently use "object" as type)

Pending Review

Which version of Bolt are you using?

Works fine here:

I think you misunderstand me. I want to have a Value Input with Type "Type". And then I want to use the RequireComponent-FlowChart as a Super Unit and want to give the ComponentType I want checked into the value input.

I am searching for this (photoshopped screenshots):
To do this:


You can easily add the Type to your options list in the type options wizard:

But changing the type of the super unit output variadically like that is not supported, because units cannot change definition based on their input. 

I want to make the equivalent FlowGraph for this function:
T Require<T>() {
if (GetComponent<T>() == null) {
return GetComponent<T>();

Thanks for the answer! That was what I was searching for. Though sad that variable outputs are not possible.

Since you said that I had to see if it was possible with the API because that would be awesome, but I really don't think it is. You can with inputs on the API though. I got it to switch on output, but it only changes on serialize/deserialize. Not very effective then.

I have a casting to objects assembly I made and will be adding to another pack of dlls eventually, it contains all the get component and add methods as native units cast to object, so you can attach to the types that don't pick up on it. Like interfaces. Because you posted this, I thought I might add Require Component in there. If you want it go ahead and grab it, just uploaded it. Else I can try to snag a pic later for you on how to do it in bolt itself. 


I was interested JasonJones, can you show me how to do?