Gavalakis

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 596 total)
  • Author
    Posts
  • in reply to: Calling Functions #2353

    Gavalakis
    Keymaster

    Hey 🙂

    If you mean calling a FlowGraph “Custom Function” from within another FlowGraph, it is possible, but it is not very straightforward (something I want to improve and make far more convenient). To do this, please:

    1. Drag and Drop the GameObject which has the target FlowGraph with the Custom Function you want to call, into the editor of the FlowGraph you want to call it from.
    2. From the menu that will pop as usual by doing such a drag & drop, please search for “Call Function” node and add it (it is a method of the FlowScriptController class).
    3. Make the newly created node “Callable” if you want to, as well as check the option for “Expose Parameters” to make this easier.
    4. Make sure you set the “Name” of the function to be the same as the one you want to call.
    5. Make sure that the “Args” you pass to the node are the same number and in same order (type-wise) as the function you want to call.

    It’s easier that it may appear, but still not as convenient of course. I plan to make all this far more easier with a new “Call External Function” (or similar named) node however.

    Let me know if that is indeed what you meant please.

    Thank you and have a great summer time!

    in reply to: Raycastall and foreach #2352

    Gavalakis
    Keymaster

    Hello and welcome! Sorry for the late reply due to summer vacation.

    I just created a similar setup and everything works correctly here, but it really depends on what is that is not working in your case.

    Please note that the Mouse (Self) Event, expects a Mouse Click ON the assigned object (in this case “Self”) which has to of course have a collider attached. If you instead only meant Mouse Click “anywhere in the screen”, you will need to use the “Mouse Button Event”.

    Is this indeed the case, or something entirely different?

    Does the Event fire at all?

    Please let me know.

    Thank you!

    in reply to: Macro from code #2341

    Gavalakis
    Keymaster

    Hello and very sorry for the late reply!

    While techically it is possible, there is not API to make it easy. With that said you can add these lines of code into Macro.cs somewhere so that this can be done easier.

    With these lines of code in there, you will then be able to use a Macro and either Set one of it’s Value Inputs, Call one of it’s Flow Inputs, or Get one of it’s Value Outputs from code. Remember though, that you will need to instantiate the Macro asset and call StartGraph to the instance. Here is an example:

    With all that said though, Macros can still not be treated exactly like a Function would, since a Macro can have multiple Value as well as Flow outputs and as such it is implemented to work differently than a function would.

    other alternative you may want to consider, is to actually use a “Custom Function” setup (in the browser -> “Function/Custom/New Custom Function”) which work similar to how a usual code function would and can also be invoked from code via the “CallFunction” method.
    For this alternative, you dont really need a Macro Asset, but a FlowScript Asset would be preferable since the inputs and outputs of the Macro does not matter.

    Thus what I would recommend doing, is to create a FlowScript Asset as normal and create a Custom Function within that FlowScript, like this example:
    FunctionFromCode

    Then from within your code, instantiate the flowScript asset and call “StartGraph” on it’s instance. Finally call “CallFunction” on the instannce wherever is required. Here is an example:

    You can of course have any number of Custom Functions implemented within the flowScript.

    Please let me know if any of two options above work for you, or if you need any more information or help.

    Thanks!

    Attachments:
    You must be logged in to view attached files.
    in reply to: Calling Unity Coroutines (IEnumerator) from a node #2339

    Gavalakis
    Keymaster

    Hello,

     

    Thanks a lot for your positive feedback on FlowCanvas.

    Unfortunately (at least right now), IEnumerator methods are not automatically treated as Coroutines by FlowCanvas. There is however a way to invoke coroutines as you would normally do in code, meaning by using a “StartCoroutine” function node like for example:

    InvokeCorutine

    In the example above however, the Log “OK” node, will be executed in the same frame when the event is called, while the coroutine will continue “running” in the background, which I suppose is not exactly what you would ideally want.

    With that said, another more proper solution for running coroutines -for now- within a flowScript, would be to actually create custom “LatentAction” nodes, in case the functionality of what you want to do, is not shared with your own codebase as well, but rather only used within the scope of FlowCanvas. Creating a LatentAction node (which basically means a coroutine node), is quite easy as well. If you open up the file named “Time.cs”, you will find a couple of LatentActionNodes (like Wait, WaitUntil, WaitWhile etc) and see how they are implemented as a base for creating your own.

    Please let me know if the above works for you, or if of course you have any questions.

    Thanks again!

    Attachments:
    You must be logged in to view attached files.

    Gavalakis
    Keymaster

    Hello,

    I think that you can try the Unity Forums or even better the Unity Connect platform to find people to work with 🙂

    in reply to: Creating formulas and tracking variable values #2333

    Gavalakis
    Keymaster

    Hello again and sorry for late reply.

    I have attached for you here the Expression Node (a unitypackage). Please note that this is only a beta/early version of the node.

    Thank you for the extra information on the Probability node. I will implement such a node in FlowCanvas in the next few days and will also be there in the next version. While you can use NodeCanvas Probability Selector, from what I see you would prefer using FlowCanvas (with the new Probability Node when it’s ready) though :).

     

    Let me know what you think regarding the attached Expression Node by the way.

    Thank you!

    Attachments:
    You must be logged in to view attached files.
    in reply to: Bug with Trigger Node #2329

    Gavalakis
    Keymaster

    Thanks for letting me know 🙂
    You are very welcome!

    in reply to: Creating formulas and tracking variable values #2327

    Gavalakis
    Keymaster

    Hello and thanks a lot for getting both assets.

    Please let me address your questions 🙂

    1. Do you mean formulas /expressions by “writing” them down, or by using several nodes connected together? Of course, it is possible with nodes, but it is not (yet) by writing down the expression. I have however worked and have an early version of an Expression Node already made (but not published). I can send you the package to try it out if you want of course though 🙂
      ExpressionNode
    2. “When” something is happening in either Node or Flow Canvas, is fully related to the system. For example, in NodeCanvas, Behaviour Trees, are making things happening in a different manner than FSMs, or FlowCanvas flowScripts. FlowCanvas flowScripts, are fully event-driven, so you could make something happen based on some event which can come from a really lot of places (like for example input, trggers, collisions, c# events, unity events etc). Is that what you mean?
    3. NodeCanvas Behaviour Trees, do have a node called “Probability Selector” which works prety much like you say. FlowCanvas on the other hand, does not have such a node, but I think it is a really good addition to make actually 🙂 I will definetely add a Probability node in FlowCanvas as well.

    Please let me know on the above and if you need any further information.

    Thanks!

    Attachments:
    You must be logged in to view attached files.

    Gavalakis
    Keymaster

    Hello again,

    This is the only way to handle this correctly (even though it’s ugly):

    Let me know what you think.
    Thanks.

    in reply to: FlowCanvas & NodeCanvas while in Editor Mode? #2321

    Gavalakis
    Keymaster

    Hello again,

    Thanks a lot for your positive feedback! 🙂
    Can you please rephrase your question, or provide a bit more details. I am not sure that I understand exactly what you mean 🙁
    Getting a reference to the FlowScriptController component, can in general, be done the same way as it can be done with any component (that is using the GetComponent function node). But I think you mean something different? 🙂

    Please let me know.
    Thanks again!

    in reply to: Bug with Trigger Node #2319

    Gavalakis
    Keymaster

    Hello,

    I have attached for you a unitypackage which includes the fix for this.
    Let me know if that works for you after you import the package.
    Thank you.

    Attachments:
    You must be logged in to view attached files.
    in reply to: Setting animator controller parameters #2313

    Gavalakis
    Keymaster

    Hello,

    You can do that by using the “Set Bool” method node. You can find the method node under “Functions/Reflected/Animator/Methods/Set Bool”, or of course simply search for it in the browser 🙂
    There also of course exist similar method node for other type of parameters (Set Float, Set Integer etc), as well as nodes for Get Float, Get Integer etc.

    Let me know if that works for you.
    Thanks!

    in reply to: FlowCanvas & NodeCanvas while in Editor Mode? #2312

    Gavalakis
    Keymaster

    Hello and thank you for your positive feedback! Much appreciated 🙂

    It used to be possible a long time ago with some (hack) changes, but it is no longer and currently not possible to execute flowscripts in edit-mode. Because FlowCanvas (and NodeCanvas) is essentially built as a runtime visual scripting tool, initialization of the graph (binding ports, instantiating macros, assigning certain references etc) is taking place in runtime only. Some things are taking place in “awake”, while others as soon as the graph is “started”. Furthermore, some nodes (event nodes more specifically) rely on the OnGraphStarted “callback” so that they subscribe to certain game events (and OnGraphStopped for unsubscribe). On the other hand of course, an editor only houdini-like tool for procedural creations does not really need event nodes for example (or most of the things like reflection that are taking place in a flowscript).

    Thus, for such a tool, I think that a brand new type of graph based on the core framework would be a better fit. For this to be possible though, I would need to decouple a few things first so that a completely new type of graph can be created by deriving from FlowGraph. Currently the FlowGraph class implements a few things that FlowScript class is inheriting and using. Those things will need to be moved into FlowScript itself where they belong better, thus leaving only framework related functionality to the FlowGraph class.

    This change is something I do plan to make and when that is done, I think that creating a completely new flowgraph type (even editor-time flowgraph ala houdini) will become far easier, but it remains to be seen of course 🙂

    If you want to elaborate on anything, please let me know.
    Thank you!


    Gavalakis
    Keymaster

    Hello,

    Just to explain what is going on, if you open up FlowNode.cs and take a look at the “GatherPorts” method, you will see that “RegisterPorts” is called within, and right after that, the “DeserializeInputPortValues” is called. If of course an exception is thrown within the RegisterPorts implementation, the “DeserializeInputPortValues” is never called and thus the port values (of this particular node) are lost since the graph is then serialized back.

    There is an exception handling per node registration (so that if one node throws an exception the rest proceed normally), but to avoid what is happening in a per-node basis when an exception is thrown, there will need to exist yet another exception handling. Changing the “GatherPorts” method to be like the following will effectively work the way you suggest (make port serialization perist):

    I don’t really like this solution a lot though. Let me know what you think.
    Thanks.

    in reply to: Custom attribute drawers #2310

    Gavalakis
    Keymaster

    Thank you for the follow up.
    I am glad it works for you in the latest version 🙂

Viewing 15 posts - 1 through 15 (of 596 total)