Search Unity

FlowCanvas - Visual Scripting Similar to Unreal Blueprints

Discussion in 'Assets and Asset Store' started by nuverian, Apr 14, 2015.

  1. spottedzebra

    spottedzebra

    Joined:
    Oct 26, 2013
    Posts:
    25
    Hi, does FlowCanvas work on consoles? I saw the word reflection in the description and that has me worried.
     
  2. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    Hello,
    Yes, FlowCanvas works on consoles, but due to consoles being AOT-only, using the reflection nodes on consoles , will not be nearly as fast as using reflection nodes on non AOT-only platforms.
    If you are not planning to use a lot of reflection based nodes or at least not use them per frame, you will not have any performance problem with consoles.

    If you have any other questions, please let me know.
    Thanks!
     
    Alexarah likes this.
  3. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    Small example of an Analogue clock.You will need the DateTime type selected in type preferences...
     

    Attached Files:

    nuverian and Alexarah like this.
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    Hey,
    That's really nice and well made! :)
    Thanks a lot for sharing!
     
  5. Alexarah

    Alexarah

    Joined:
    May 1, 2014
    Posts:
    110
    Hi nuverian I think that the documentation on your site for Flow Canvas could be way more helpful if you were to make tutorials on how remake Unity's Survival Shooter or a basic 2d platform game with just using Flow Canvas like what Gaming is Love did with Makinom. Basically Gaming is Love posted a written step by step on their site in the tutorials section of how to make various basic games and even how to remake Unity's Survival Shooter with Makinom alone without writing a single line of code! So if you can consider doing this even if it takes a while a lot of people including myself will heavily appreciate it.:)
     
    LazyFox17 likes this.
  6. vestigial

    vestigial

    Joined:
    May 9, 2015
    Posts:
    140
    Hi, does it not work to use Send Event to trigger a Custom Event on the same graph?
     
  7. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    I have used Send Event on the same graph without any problems.
     
  8. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    nuverian and Alexarah like this.
  9. Alexarah

    Alexarah

    Joined:
    May 1, 2014
    Posts:
    110
  10. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    I am working on the Space Shooter tutorial in flowCanvas at present,and I also have some ideas for expanding the Roll_A_Ball game.
     
    Alexarah likes this.
  11. Alexarah

    Alexarah

    Joined:
    May 1, 2014
    Posts:
    110
    Sounds great westray. I'm looking forward to see the results. You did a good job on the Roll A Ball game by the way.
     
  12. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    Thank you for your kind comments.I really like flowCanvas.
     
  13. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    When I try and run the Roll_A_Ball game as a web build in firefox I get the following errors

    Any idea what the problem is ,I am using unity build 5.5.1f1 64-bit
     
  14. vestigial

    vestigial

    Joined:
    May 9, 2015
    Posts:
    140
    I figured it out, the graph wasn't ready right when it was loaded, I had to start a coroutine and wait until the end of the frame, then it was able to pick up events. So if anyone else has that problem, try giving it some time to load/get ready.
     
  15. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    That's really great!
    Thanks a lot for making and sharing this!
    Looking forward to see what you come up with next :)

    Regarding the error you see on browser, please open up “Tool/ParadoxNotion/FlowCanvas/Preferred Types Editor” and hit the “Generate AOT Classes…” button. This will create some required files relevant to AOT only platforms, like WebGL is.
    Please let me know if doing the above, will make the project work for you.

    Thanks again!
     
  16. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    I am now getting the following error in the console

     
  17. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    Hey,
    I just want to let you know that I am looking into this issue.
    Can you please open a post in the FlowCanvas support forums? If so that would be great!
    Thank you.
     
  18. westray26

    westray26

    Joined:
    Oct 15, 2016
    Posts:
    8
    Just a small start on the Survival Shooter Tutorial.You will have to download the Survival Shooter asset from the asset store and import flowCanvas.You will also have to rebake the navmesh for it to work.A lot more to do !!!
     

    Attached Files:

    Last edited: Mar 29, 2017
  19. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    Once again, thanks a lot for sharing!
    Looking forward to whatever you come up with next and how you proceed with this! :)
    Thank you!
     
  20. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hello guys!

    I'm kind of back again. I wanted to do something super simple so I can learn some stuff. I decided to do some really super super simpel Plants vs Zombie thing.

    Right now I have a "ground tile" prefab.



    I want it so when I click any of the green tiles, I get the Game Object that was clicked.
    I'm not sure what Event to do... I tried Mouse Click, Collision2D, etc.

    I basically want to take the Game Object that was clicked and send it to the game manager.
    Then the game manager will Instantiate a prefab on that game object.

    The Green Tiles have a Box Collider 2D (Set up as Trigger).

    Thanks

    ----------------
    Also, what would be the best way to do this...

    I want to check a String variable. If String variable = Sunflower > I spawn the prefab Called Sunflower.

    If String variable = Nasty > I spawn the prefab called Nasty.

    Someone suggested to use a "Dictionary" but I don't know how to do that in FlowCanvas.
     
    Last edited: Mar 30, 2017
  21. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    Hello and welcome back :)

    About Mouse events, it's true that I omitted adding the 2D version of "Events/Object/Mouse" event that works with Collider2D instead of Collider. I have attached the new node for you here (this will be included in the next version as well).

    About checking a string variable, the simplest way would be to use the "Flow Controllers/Switch String" node, which I think does exactly what you want :)
    SwitchString.png

    Let me know if those work for you.
    Cheers!
     

    Attached Files:

  22. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Thanks :) I will try it out.

    I'm glad that at least my problems trigger new events for you to add to the package :D

    --------------------------------
    I was kind of bored on playing video games today so your post came right on time :D

    Made some nice satisfying progress.


    Here I check to see if there is already an "object" on that tile. If not, I send an event to the main Game Manager with the clicked tile.


    Once I know the clicked tile I verify that I have a plant selected (that usually happens when I click the UI with the desierd plant).
    Then I Instantiate a new Prefab... to the position of the clicked grass.
    I set up the new instantiated plant into the $newPlant variable.
    Then I Set Parent of the $newPlant to this clicked Tile.

    I had to create a new variable called $newPlant because if I was going directly from UnityObject.Instantiate -> Set Parent I was getting an error.


    This is the "selectedPlant" event. It:
    1. Sets the $selectedPlant string to the received event (send by the UI button code).
    2. I do a Switch String ...
    3. I just drag & dropped a prefab into the FlowScript Canvas and bam! Now I have a reference to my prefab. I had no idea how to "link to my prefab object".
    4. Then I store the prefab into the "selectedPlantGO".

    Not sure how effective this will be because I will get a lot of those "set $selectedPlantGO" thingies... for each plant I want to add. Is there a better way?


    Anyway... thanks for making my Sunday more interesting :) I will continue tomorrow.

    I still want to:

    1. Make a resource.
    2. Each plant costs a resource.
    3. Sunflowers cast a "sun" and when that sun get's clicked resources are added.

    I think this might be enough for this exercise.

    I might do:

    1. Plant that shoots.
    2. Add health to the plants.
    3. Spawn Zombies that walk on each grid.
    4. If a zombie reaches a plant it will start to damage the plant.
    5. If a zombie reaches the end of the row... lose a life or something.

    Things get a bit more complicated once you have to implement the "combat".
    What do you guys think?
     
    Last edited: Apr 2, 2017
    nuverian likes this.
  23. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I want to keep all the relevant information to the relevant GameObject.

    For example I have a "Plant" ... and I want to keep the "Price of the Plant" in a variable on that Blackboard of the plant.

    However, now I'm on my Game Manager script, and I want to check the Price of the Plant. How can I check a Variable from another Game Object?

    RIght now I'm trying to send an event to the plant blackboard in order to request the value of the variable, then send that variable back to the Game Manager.

    EDIT:
    That Plant is still a Prefab, I didn't instantiated it yet. I'm not sure if you can check values from a Prefab. I first want to check the price of the plant, and if I have money, only then Instantiate the prefab. In theory this supposed to work, but the Prefab's FlowScript does not get started.

    EDIT2: Found out you can't send Events to a prefab.
    I also Found out that if you DRAG & DROP the Blackboard (script) to your other Canvas... you get a lot of S*** there :D



    Hmm... this is not working. Bug or am I doing something wrong?

    EDIT3:


    :oops::oops:

    I started debuging and noticed that if I input something else on the Name, I don't get anything. But if I input a variable that I have, I get the variable name. SO something must be ok. Then I looked into the options and I saw the "Get value"... and I decided to try it out! It works!!!
     
    Last edited: Apr 4, 2017
    nuverian likes this.
  24. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I did some huge progress overall :D
    I will do a tutorial once I'm done... I think other beginners can learn from my experience.

    Right now I'm trying to see how can I "show a sprite" next to the cursor & move the sprite with the cursor.
    -----------------

    I'm also trying to do a Linecast from a plant ... to see if that raycast hit's something. I'm having problems with this one. I also tried to DrawLine in order to see something... nothing :(
     
    Last edited: Apr 4, 2017
    nuverian likes this.
  25. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    @GamePET
    It's really great of you posting all the progress you are making! Certainly keeping things very interesting! :_)
    It's a bit hard for me to track the questions though, in case you have any :)
    About the Debug.DrawLine, and basically any color parameter, just note that the default color is not just black. it's actually completely transparent (Alpha = 0). So you might want to set the color parameter to Alpha = 1 to see the line in this case :)
     
  26. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Well basically this is with what I'm struggling right now:

    1. Make a sprite to follow the cursor. I'm trying to show that I have the a "Plant Selected" and I want to display a Sprite next to the cursor, wherever that cursor moves.

    2. I want to do a Linecast / Raycast (whatever is better) from a plant to about ... 100 uits in front of the plant. I want to detect if anything colides with that Linecast/Raycast ... if it does I will trigger a Plant Fire.

    I already made the fucntion for Plant Fire, but I don't know how to do the Linecast/Raycast in order to check for the colision.

    I have been trying first to do a DrawLine since a DrawLine has "kind of" the same settings for a Linecast but I wasn'ta ble to see anything. I didn't check the Alpha however. I did a thing where I was taking the PLANT position, making an ew Vector 3 (or vector 2 I forgot)... I was extracting the vectors... then I was feeding the vectors into the DrawLine numbers :D

    EDIT: Omg... it was the alpha of the Debug.DrawLine. I can actually see a line now!



    Any idea what I'm doing wrong? This is the "NastyObject":
     
    Last edited: Apr 6, 2017
    nuverian likes this.
  27. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Well I think the problem with the NastyObject is the fact that... it doesn't have a rigidbody2D. I played 2 days ago with colliders & stuff and I was finally able to do a checkup when my Zombie is coliding with the plant:



    Another problem was that... my "Grass Tiles" also had a colider... so basically zombie & probably the raycast was also coliding with the GROUND!!!!1

    lol. N00b mistake.

    So I think right now I can try to make the raycast work... but I would still be open on how to "properly" make a:

    Linecast that detects when it colides with a game object that has the tag "Zombie".
     
    nuverian likes this.
  28. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052

    Hey :)
    Here is one way, to do a LineCast and check if the hit object is of some specific tag and continue accordingly:
    SwitchLinecastHitTag.png
    If LineCast returns true because of something is hit, switch the tag of the RaycastHit.transform (auto-converted to gameobject in this case).
     
  29. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Ahaaaa.... then I just continue to do stuff from the Switch Tag ... from the Tag i want.
    This is brilliant!

    Any idea how to make a "Sprite" follow the cursor?


    P.S. After I'm finished with this I will try to make this a tutorial... video & text. Maybe my findings will help other people.
     
  30. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Meh



    It's still showing false.



    This is my zombie. Could it be because I'm using a 2D stuff... and the Physics.Linecast is ... the normal one and not the 2D one? I wanted to use the 2D one but it has no BOOL version.
     
  31. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    Hey,
    Sorry for the late reply due to Eastern vacations.
    Yes, You will need to use the Physics2D functions for all 2D physics related things, otherwise it won't work.
    It's true that the Physics2D.Linecast does not return a boolean, but you can check if a hit was made, by checking if the RaycastHit2D returned .transform property is null or not, like in this example:

    LineCast2D.png
     
    GamerPET likes this.
  32. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Thanks Nuv!

    I also finally found out why it always was False! The linecast was hitting it's own colider ...



    This is how it looks so far. Seems to work.

    If I'm coliding, I'm checking to see if it's with a Zombie.
    If I'm not coliding, I just set the $isFiring bool to false, so the plant actually stops firing.
     
    Last edited: Apr 19, 2017
  33. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Well it seems that I still have some problems with this.
    At one point I was coliding with the "Grass" (my ground tile).
    Then the bullets were Linecasting themselves... meaning that the play will always fire...

    So I really want to check the Layer.



    I decided to try to use this in order to take advantage of a Layer Mask, however I don't know how to do it. My Zombie is on Layer #8. How do I specify to only check the layer 8? If I put 8 on the Layer mask nothing happens.

    I have read that trough code you have to do something like 1<<8 ... but here I don't know. I tried so many things that I'm trying to get very confused :D

    -----------------------
    EDIT:

    GOTTA LOVE MURPHY'S LAWS! The moment I ask, the moment I find the solution... I think...



    I created a new variable of type "LayerMask" ... I'm getting it's value and I'm feeding it into the Layer Mask. It seems to work... for now...
     
    Last edited: Apr 23, 2017
  34. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Ok. Who can explain this.

    I have a "bullet" and when that bullet is coliding with a zombie, is seding a message to the zombie with a damage value (an integer). In our case is 1.



    This is the event that the zombie receives. I checked, the zombie ALWAYS receive the Value of 1.
    Zombie has heath 10.

    The first time the zombie get's hit, it will go from 10 to 9.
    The second time the zombie get's hit, it will go from 9 to 7.
    The 3rd time the zombie get's hit, it will go from 7 to 5.
    etc.

    WHY? Why the first time it goes down by 1 point but all the other times it goes down by 2 points.
    I even tried to do the math manually, like GET $health ... - (minus) the Event Value ... that I feed into a Set $health.

    It does the same thing.

    First time the zombie get's hit:


    2nd Time the zombie get's hit:

    See...

    Anyway... it's 5:36 AM...
     
  35. HolyShovel

    HolyShovel

    Joined:
    Jun 19, 2013
    Posts:
    156
    1<<8 its bit shift which mean simple pow(2,8). Or 100000000 in binary representation of number. About your problem with health. Try log something in your graph. Its look like you call event more than one time.
     
    GamerPET likes this.
  36. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    It's true that the evend is being send twice, but only starting from the second hit, never on the first hit. This is so weird :D

    The bullet get's destroyed after hitting the zombie. So... the next bullet that comes ... also only send the message only once. It has the same logic after all...

    But then again... this is the log:


    It clearly says "Event XXX Send to "zombie". It says that TWICE.... meaning that the bullet sends the event twice... but never on the first go!


    This is the Bullet logic. Imediatly after I send the event, it destroy itself... he has no time to send another event. The "Target" of the Send Event is the "Other" from the Trigger. It's the Zombie basically.
     
    Last edited: Apr 25, 2017
  37. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Ok... it seems that somehow I fire 2 bullets at the same time, and they are under eachother so it seemed that there is only 1 bullet. Now to see why I'm firing 2 bullets :D

    I just decided to check this at 3 AM... :D



    It was because of the WAIT. I was doing a fire at the START but also at the FINISH.

    Works now! :D
     
    Last edited: Apr 26, 2017
    nuverian and HolyShovel like this.
  38. HolyShovel

    HolyShovel

    Joined:
    Jun 19, 2013
    Posts:
    156
    Dont be afraid to be a "log maniac". Logs can be very usefull. =)
     
    nuverian and GamerPET like this.
  39. yotingo

    yotingo

    Joined:
    Jul 10, 2013
    Posts:
    38
    Hi,

    I'm trying to Instantiate a game object, find a script attached to one of it's children, and change a variable on that script. The object with the Flowscript attached as well as the object with the C# script are both prefabs instantiated at run-time.

    How do I properly use GetComponent in Children?
    How do I reference the variable of a C# script on another game object?

    Here is my attempt: (gets stuck moving from Instantiate to Get Component in Children)

    https://drive.google.com/file/d/0B81HMEUnKa8WN2ZSVzByY1Jtb1U/view?usp=sharing

    Here is the code I'm trying to replicate:


    https://drive.google.com/uc?export=download&id=0B81HMEUnKa8WYm9Md1E4NmV1LWM
     
  40. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    Hello,

    Do by stuck, you mean that there is an error appearing at the Instantiate node?
    If so, there is currently a misleading bug which allows you to connect the return type of Instantiate which is UnityEngine.Object to the input of a Component or GameObject type, but the conversion is not handled correctly as it should.

    Please, add a Cast To (GameObject) node just between the two nodes like in the image bellow and let me know if that works for you.
    CastToGO.png

    Thanks!
     
    GamerPET likes this.
  41. yotingo

    yotingo

    Joined:
    Jul 10, 2013
    Posts:
    38
    That worked perfectly.

    Thanks!
     
  42. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    nuv to the resque as usual :)

    What are you up to Nuv? Still sick or got better?
     
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052
    You are very welcome :)

    Hey!
    Yes I am all good now. Thanks a lot for your concern!
     
    GamerPET likes this.
  44. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I was just looking at my "receiveDamage" code on my Zombie:


    And I was thinking... I could use the same code for my Plants... so when they receive the Damage from the zombies.
    If I want to reuse this exact same thing... I have to make it a Macro? I never used Macros before so I want to be sure.

    I still have to implement "Zombie dealing damage to plants" which I'm not yet in the mood to do. I was just thinking on just making the video/tutorial like it is and move to a new thing. This is the down side when you take a break from things :D

    I could also implement Sounds and see how they works.

    Question:
    When should I use INT and when should I use FLOATS? Or is it just safer to use Floats.
    I was looking at my event and it's INT based... but now I'm thinking that maybe I will deal some "float damage".
     
  45. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,052

    Hey,

    If you want to reuse a node tree, then yes, Macros are the way to go :)
    Regarding using Integer vs Float, at least for a damage/health system, it's really totally up to you how you want to design it. There is no right or wrong here. Probably using integer for health/damage is easier though, but that's all :)
     
  46. HolyShovel

    HolyShovel

    Joined:
    Jun 19, 2013
    Posts:
    156
    About int vs float in health system... If you have very simple system, like direct damage without damage types, resistance with procents and another "complex" stuff - use int. But if you plan add really complex things - I suggest use float.
     
    nuverian likes this.
  47. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Thanks.

    Any idea how to make a sprite follow the mouse cursor?
     
  48. HolyShovel

    HolyShovel

    Joined:
    Jun 19, 2013
    Posts:
    156
    It's very easy.
    upload_2017-5-15_18-27-27.png
    fc_sprite.gif
    P.S. I use ortho camera. With perspective you need tune z of mouse pos vector.
     
  49. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Interesting! Why use "On Late Update"? Because this is not as important like other calculations?
     
  50. HolyShovel

    HolyShovel

    Joined:
    Jun 19, 2013
    Posts:
    156
    If you move something what must move smooth I suggest use late update because it called right before render.
     
    GamerPET likes this.
unityunity