Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[Released] uNode - Visual Scripting [Support C# Import/Export]

Discussion in 'Assets and Asset Store' started by wahid_rachmawan, Oct 18, 2017.

  1. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    @wahid_rachmawan
    Thank you, working with uNode is getting more and more enjoyable. :)

    But we still have some work... ;)
    Next ---> error when trying to compile:
    2018-12-06_01-46-08.png

    P.S.
    """............................Also after parsing, there are problems with nodes "Divine", changes the output to the object type <--------->
    Can you send me the script for i can test?..................."""
    Do you still want this file? have you already repaired?
     
    Mark_01 likes this.
  2. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    This bug also has been fixed ;).

    Yes i need a sample script to fix it.

    I'll upload new update on sunday.
     
  3. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    I have:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3.  
    4. public class A_TEST1 : MonoBehaviour
    5. {
    6.     public int variable0 = 10;
    7.     public int variable1 = 0;
    8.  
    9.     public void NewFunction()
    10.     {
    11.         variable1 = (variable0 / 2);
    12.     }
    13. }
    parsing... --->
    2018-12-06_10-10-36.png

    And the compilation back to the C # code... --->
    2018-12-06_10-16-36.png
    (Despite the errors the code is OK, although the "(int)" part is unneeded.)
     
    Last edited: Dec 6, 2018
    Mark_01 likes this.
  4. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    @wahid_rachmawan

    Performance ---> 2018-12-06_18-30-07.png
    I think the loopObject variable is unnecessary, because tempVar can be used directly.

    2018-12-06_18-41-26.png
    Also I think it's better to define the loop variable inside the for loop, instead of using a class variable.

    And... parsing error --->

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3.  
    4. namespace test
    5. {
    6.     public struct S_Human
    7.     {
    8.         public string Name;
    9.         public int Age;
    10.         public Vector2 Position;
    11.     }
    12.     public class A_TEST3 : MonoBehaviour
    13.     {
    14.         public S_Human Create_Human(string name, int age, Vector2 position)
    15.         {
    16.             return new S_Human() { Name = name, Age = age, Position = position };
    17.         }
    18.     }
    19.    
    20.    
    21. }
    2018-12-06_18-55-17.png

    I also can not use initializers at all for such defined structures.
     
  5. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    Fixed, will available in next update.

    This is a bug, previously it use tempVar when you use 'Value' on the next flow.
    Will be fixed soon.
    I'll investigate and fix it ASAP.
    Edit: It likely reflection can't obtain a parameterless constructor of a struct because it does not exist. I'll find another way to fix it.
    Edit2: fixed in the next update;).

    Thanks for report it.
     
    Last edited: Dec 7, 2018
  6. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    @wahid_rachmawan
    Thank You very much. :)

    Suggestion:
    There should be a possibility to assign a starting value to a variable (both class and local), which isn't always possible now - for example in case of custom structs. And there should be a possibility not to assign it when it's not needed, which would produce cleaner C# code.
     
  7. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    You can assign starting value for both class and local variable.
    For assign starting value for local variable just double click on variable and it will show popup window which you can assign a starting value:
    Screenshot (254).png

    For struct the only way to have starting value is by auto creating default constructor which assign variable value, this will available soon.
     
  8. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    Yes, I know, apparently I was wrong and it was all about my own structures. ;)
    (But... there should be a possibility not to assign value when it's not needed, which would produce cleaner C# code.)

    Meanwhile, my current node reduction record:
    2018-12-07_20-52-50a.png

    The King is dead, long live the King! :cool::):cool:
     
    Last edited: Dec 7, 2018
  9. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    Ah sure, for local variable you can leave it not assigned by destroying the instance value but on generate only struct type will leave empty and for class type will have null assigned to it (because to prevent error when you're generating code: get variable that is not assigned, i know it useful for newbie but assigning start value to null not have impact on performance).
    For not assign value for classes will available soon.

    Cool reduction, you can also reduce more by using Action nodes. With you current graphs i think using Action node reduce up to 4 more nodes.
    Action node can be used to invoke or set value of a variable just like flow node do but the limitation is it's not supported interact with value node.

    Thanks for your suggestion.
     
    AthrunVLokiz likes this.
  10. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    For now, I'm learning basic things... ;)

    next --->
    2018-12-08_14-15-21.png

    And... --->
    2018-12-08_14-58-29.png
    In general, there is something wrong with parsing scripts with enumerators. All of my C # scripts worked correctly, so ...

    P.S.
    Anyway, I will wait patiently for better and better uNode. :cool:
     
    Last edited: Dec 8, 2018 at 5:44 PM
  11. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    Can you send me the sample script for i can fix it....
    Hope i will fix it before launch new update.
     
  12. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    ok...
    I have two scrypts:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class A_test_enum : MonoBehaviour
    6. {
    7. }
    8. public enum Enum_0
    9. {
    10.     small = 0,
    11.     medium = 1,
    12.     large = 2,
    13. }
    and...
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3.  
    4. public class A_test : MonoBehaviour
    5. {
    6.     public Enum_0 variable0 = Enum_0.small;
    7. }
    8.  
    When I try to parse a second one, I have this error --->
    2018-12-09_15-58-58.png

    EDIT//
    If I have everything in one script - then parsing works correctly --->
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class A_test_plus : MonoBehaviour
    6. {
    7.     public Enum_1 variable0 = Enum_1.small;
    8. }
    9. public enum Enum_1
    10. {
    11.     small = 0,
    12.     medium = 1,
    13.     large = 2,
    14. }
     
    Last edited: Dec 9, 2018 at 3:23 PM
  13. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    What the method do you use for parsing? (MonoScript, Source, or File)

    Edit: Fixed in next update, this cause when parsing enum outside of source the type name is included.

    Thanks.
     
    Last edited: Dec 10, 2018 at 2:32 AM
  14. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    Always MonoScript.
     
    Last edited: Dec 10, 2018 at 4:56 AM
  15. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    uNode v1.7.2 has been submitted for review!

    changelog v1.7.2:
    -New realtime C# Preview Windows.
    -Added PerSecond value node.
    -Improved CSharpGenerator
    -Improved CSharpPreviewWindow
    -Improved Editor
    -Improved ErrorChecker
    -Fixed bugs parsing property set accessor.
    -Fixed bugs error on parsing enum type outside of source.
    -Fixed bugs ErrorChecker error on check divide operator.
    -Fixed bugs ErrorChecker error on check SetValue node.
    -Fixed bugs error on generating property and constructor.
    -Fixed warning related to null texture on draw node.


    Download here : http://maxygames.com/download/

    The new realtime c# preview windows with syntax highlighter help you learn c# with uNode.

    Keep note that the c# output from preview window may have different with the final c# (this because final c# uses more options for make code more less and readable ex: remove type namespaces)

    How to enable syntax highlighter:
    • Need at least Unity 2018.1 or higher.
    • Import CSharpParser.
    • Syntax highlighter is now enabled.
     
    Last edited: Dec 10, 2018 at 4:48 PM
  16. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    Thank You very much. :cool::)
    Where to get my invoice number? EDIT// i have it :)

    P.S.
    Error when using IF in property setter also is fixed? (post 293, third error)
     
    Last edited: Dec 10, 2018 at 4:42 PM
  17. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
  18. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    @wahid_rachmawan
    Thank you so much, now I am going to sleep ... but I will check tomorrow.
    I noticed that the error with the node "break" also applies to the node "continue"

    I guessed. ;)
     
    Last edited: Dec 10, 2018 at 5:20 PM
  19. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    Do you mean the warning?
    I think i have fix it too, just check it out when you wake up;).

    I just post in this thread and my discord channel.
     
  20. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    uNode v1.7.2 has been released on the Asset store.
     
  21. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    I checked all reported bugs except constructors - and everything works, thank you. :)

    But I have new ones. ;)

    I have three scripts --->
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class Script_0 : MonoBehaviour
    4. {
    5.     public System.Collections.Generic.List<UnityEngine.Vector2> Var_vector0 = null;
    6. }
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class Script_1 : MonoBehaviour
    4. {
    5.     public static Script_0 Var_script0 = null;
    6.  
    7.     public static Script_0 Prop_script0
    8.     {
    9.         get
    10.         {
    11.             return Var_script0;
    12.         }
    13.     }
    14.  
    15. }
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class Script_2 : MonoBehaviour
    4. {
    5.     public int Var_int0 = 0;
    6.     public int Var_int1 = 0;
    7.  
    8.     public void NewFunction()
    9.     {
    10.         Var_int0 = Script_1.Prop_script0.Var_vector0.Count;
    11.         Var_int1 = (Var_int0 + 1);
    12.     }
    13. }
    Parses the third script --->
    2018-12-12_23-34-43.png
    Everything looks good when parsing, but when I try to do it myself in the uNode editor, I have errors suggesting that this is a non-static property - hence the request for instances
    2018-12-12_23-36-06.png

    EDIT//
    2018-12-13_00-53-01.png
    The compilation seems fine, but there is still error information - it applies to the four selected operator types.
     
    Last edited: Dec 13, 2018 at 12:12 AM
  22. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    Will be fixed ASAP.

    Thanks for report it.
     
  23. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    @wahid_rachmawan

    next ----->
    I have script:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class Script_0 : MonoBehaviour
    4. {
    5.     public int NewVariable = 0;
    6.  
    7.     public void NewFunction()
    8.     {
    9.         switch (NewVariable)
    10.         {
    11.             case 0:
    12.             case 3:
    13.                 NewFunction1();
    14.                 break;
    15.             case 1:
    16.             case 2:
    17.                 NewFunction2();
    18.                 break;
    19.         }
    20.     }
    21.     public void NewFunction1()
    22.     {
    23.     }
    24.     public void NewFunction2()
    25.     {
    26.     }
    27. }
    After parsing ----->
    2018-12-13_17-28-55.png
    After parsing, I must manually delete unnecessary nodes "break". Besides, it would be nice if the compiler did not repeat the code.

    P.S.
    It's nice that I can help in improving this extremely cool tool. :)
     
    Last edited: Dec 13, 2018 at 4:33 PM
  24. wahid_rachmawan

    wahid_rachmawan

    Joined:
    Oct 4, 2017
    Posts:
    161
    Will be fixed ASAP.

    Thanks for reporting it.
     
  25. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    122
    @wahid_rachmawan
    Thanks.

    Next --->
    I Have script --->

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3.  
    4. public class Script_0 : MonoBehaviour
    5. {
    6.     public List<int> List_int = new List<int>();
    7. }
    I create second script in uNode ... --->
    2018-12-14_03-32-03.png

    An attempt to compile --->
    2018-12-14_03-35-11.png