So I was looking through the forums and the unity forum thread for ways to handle getting and setting blackboard variables on other GameObjects’ Blackboards.
And I think what I kept finding was mostly workarounds. Such as using global blackboards.
Or, statements that you’re working on a better solution.
Anyhow, I hacked up some nodes based on your existing nodes. They seem to work. But they could be better. And I’d like some thoughts.
All I really did was add a ValueInput of type Blackboard. Then I made sure to set the appropriate BBParameter’s .bb field just before it’s value is read.
Is that a good way to go about it? Or is there something horribly wrong about it?
Also, I very much wanted to override the OnParentConnected method of the node, so I could update the BBParameter’s .bb field when the Blackboard input is changed. This would make the GUI Inspector work correctly if I could do it, probably. But you sealed those methods. So I can’t override them. I’d request you unseal them. They currently do nothing right now anyway.
For now, with those methods sealed, I just change the BBParameter to “DynamicVar” and then type in the Blackboard Variable name. Which works well enough.
Since these are just slightly hacked up versions of your code, I’m not posting them unless you tell me it’s okay to do so.
Another thought: There may be very little reason to create new nodes for this in the end. Perhaps you should just do what I’ve done? By default, the “Blackboard” inputs default to “self” which is the same behavior as they already have. But that provides the flexibility to cast/convert any component in the flow into a Blackboard component, to do a referenced variable lookup. Which is probably right.
The only issue I see here is when setting the BBParameter.bb from the input Blackboard type port value.
If you do this in the editor, the ports are not yet binded, so I can see this work only in playmode, unless I am missing something 🙂
Please, feel free to post the nodes here so I can take a look. I don’t mind posting nodes here at all.
I have also attached here the updated variable nodes. This package includes 2 nodes that are able to Get/Set blackboard variable from a blackboard other than the one the flowscript is using. This is done similar to what you probably have, by having an input of type Blackboard, but the key difference here is that instead of using a BBParameter, it simply use a string to enter the name of the variable to get/set from.
The problem of using a BBParameter instead of a string (or DynamicVar in your case), is that if the blackboard is fetched by a connection instead of a direct reference assignment in the inspector of the node, it will need to be evaluated in the editor and even if I allow binding ports within the editor, I am not sure if evaluating the ports in the editor is a good thing to do, which is required to resolve the blackboard reference.
Once again, please feel free to post your nodes here and let me know if the new nodes in the package suffice or you have a better suggestion.
The new get/set nodes can be found under “Variables/Get Blackboard Variable/Get Other Of Type(T)” and respectively “Set Other Of Type (T)”
You’re right about the bb parameter not being resolvable until runtime. My mistake.
I see the nodes you published here are in the newest release in the asset store. So I’ll give them a try. I don’t think I’ll post my versions as there’s no point in duplicating functionality. Thanks for the update. I’ll get back to you if there’s anything worth bringing up once I’ve tested them out.
Author
Posts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.