FlowCanvas Forums › Support › Reflected nodes that should act as events?
I’d like to ask, I’m having issues with trying to set up actions happening in flowcanvas when I want them to/accessing event moments as they happen.
Below are a couple of example node-
https://i.gyazo.com/65659a4f5a77d9fcfa303de6886a524d.png
https://i.gyazo.com/0ef1d20e0f67b13a50a2ac301348f51e.png
I want to be able to have it react just when it’s happened, however the flow just continues through the object if it’s connected to the update event in the graph.
I know there’s documentation for custom events however that’s above me as someone who can only manage visual programming,
is there some method or workflow available I’m unaware of to get those above nodes as events? I’d really appreciate any help with this as it has left me at a dead end for my progress.
It looks like your nodes are extensions rather than custom nodes. Try following the instructions here:
That should let you use it as a triggering node.
It looks like your nodes are extensions rather than custom nodes. Try following the instructions here:
I know that they are reflections and as I stated I’d looked through the documentation there, and I don’t have the programming capabilities to make custom nodes. I appreciate your response but that doesn’t help at all.
I’m asking if there’s some method to get those as events somehow without having to end up programming it completely myself, as I can only manage visual programming.
This programming isn’t too tough. It might take a couple hours of work, but the end result will be what you want 🙂
I actually just did it… so maybe you can do the same:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
using UnityEngine; using ParadoxNotion.Design; namespace FlowCanvas.Nodes{ [Name("Simple Sensor")] [Description("Fires when a unit enters the sensor")] public class SensorNode : EventNode<SimpleSensor> { private FlowOutput entered; private FlowOutput exited; private IUnit lastUnit; private Vector3 lastPoint; private GameObject lastSensor; public override void OnGraphStarted(){ target.value.OnSensorEntered += SensorEntered; target.value.OnSensorExited += SensorExited; } public override void OnGraphStoped(){ target.value.OnSensorEntered -= SensorEntered; target.value.OnSensorExited -= SensorExited; } //Register the output flow port or any other port protected override void RegisterPorts(){ entered = AddFlowOutput("Entered"); exited = AddFlowOutput("Exited"); } void SensorEntered ( IUnit triggerer, Vector3 pos, GameObject sensor ) { lastUnit = triggerer; lastPoint = pos; lastSensor = sensor; entered.Call(new Flow()); } void SensorExited ( IUnit triggerer, Vector3 pos, GameObject sensor ) { lastUnit = triggerer; lastPoint = pos; lastSensor = sensor; exited.Call(new Flow()); } } } |
Mine has two events tho, but you can just delete one.
I believe you when you say you don’t have the skill now – but I don’t believe you when you say that visual programming is all you can manage…. it’s just all you have managed yet to this date. Tomorrow that can change if you are willing
I again appreciate your response, and sincerely appreciate the time and effort you clearly put into it,
however you are ignoring the subject of my question and dismissing my ability to judge what I can/can’t do myself.
If everyone had equal ability to do anything the term ‘genius’ wouldn’t exist.
I’ve attempted programming heavily for consecutive months, multiple times in the past with C/C++ and consistently reached a point early where I could no longer keep up with what I needed to know, infinitely before anything required for game development, however I’m able to understand the flow enough to build games with visual programming.
And that’s without commenting on the vast difference in development time between visual programming/programming nor the tools required.
I’ve had to explain this to 95% of the people responding to me when I ask questions.
Regrettably the effort you put into the code above neither helps me get closer to understanding what I need to do to be able to access the events of assets I’m using and I’m only barely able to even guess what you’ve written results in, with things like completely not understanding “IUnit” after searching for it and barely even finding mention of it let alone an explanation.
However I’d rather not have this topic drift further off topic so I’m not wishing to ask what that is here.
I reiterate please, I’d like to know if there’s any method to tap into other assets beyond just adding every type associated with them via the ‘Preferred types editor’ in a way that lets me have reactive events like how I can see them being used in their tutorials.
Or is their no method for this and flowcanvas can only ever access non-event functionality without programming each individually?
Hello,
The only nodes that are possible to be used to subscribe to events in a generic way is the ‘Code Event’ and ‘Code Event(T)’ nodes.
Both of these nodes though, work only if the events are created in a very specific way and not everyone use this way for declaring event for sure.
Events are very strict in how they work in c# and that is the reason why it is practically impossible to support all type of events that can exist in different assets.
Is there any documentation about the assets you are referring to? If so let me know.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Currently I’m having the most difficulty trying to build a custom event for getting the moment an entity is ‘attached’ in the Photon Bolt architecture.
http://doc.photonengine.com/en-us/bolt/current/getting-started/bolt-102-properties-and-callbacks
1 2 3 4 5 6 7 8 |
using UnityEngine; using System.Collections; public class CubeBehaviour : Bolt.EntityBehaviour<ICubeState> { public override void Attached() { } } |
The difficulty is increased because the 2nd “Creating Event Nodes” example documentation for FlowCanvas, regarding custom events that have a type of object you can equip doesn’t function, so I can’t work out how all of that comes together (e.g. if value is getting the ‘MyComponent’ (or whatever that would be)), etc.
Also I can’t use the “public override void Attached()” inside the custom event as it says the “Attached” namespace isn’t valid.
Note that I’d like to use ‘Transform.GetComponent<BoltEntity>().GetState<IState>()’ (with Transform as the MyComponent value) because I believe that’s required for the ‘Bolt.EntityBehaviour<()> section to function. At the very least I needed that elsewhere.
I’m trying to make it as generic as possible so I can use it for all my entity’s required using Photon Bolt.
Thanks a lot for your response, hoping the above can help find some way to solving this, even if you could just give a more functional example for the second Custom Event type shown in the FlowCanvas documentation.