Search Unity

Resolved Script Machine name / Graph Title not showing properly, code not firing.

Discussion in 'Visual Scripting' started by Carcophan, Aug 9, 2021.

  1. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    Hello everyone.

    *************************** ***************************
    The title of this thread was changed, please see the bottom most post for the current issue. It started as this upper issue, which I think is related to this larger overarching issue of the Graph name not showing properly within the Script Machine on the Player Object
    *************************** ***************************





    Strange question, trying to learn why or how this is happening.


    I have random values, multiplied by a variable. I set the values to a debug, in addition to the existing Vector3 New location. The New location works, the item moves to (20, -40), but what is with the 'toString' values, the -10, and 30.

    Both blue lines are coming out of the same multiply section - why would each line out of that node have a different value?

    upload_2021-8-9_13-40-8.png


    I removed the two debug calls, and just left the movement, and am getting this with multiply:

    2 X10 = 20. Ok. Seems alright to me.


    20 X 1 = 60??


    upload_2021-8-9_15-0-3.png
     
    Last edited: Aug 15, 2021
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    The first debug issue could be explained with Bolt retroactively triggering the logic for IntToString/Debug nodes. You need to cache the first value into a flow or graph variable or use the Cache node to reuse the same value later without it being recalculated.

    The second issue looks weird though. Perhaps try using the Scalar Multiply rather than the generic one.
     
  3. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    I'm also having a problem with the Inspector, and the Macro names associated with the Flow Machines, as well as OnClick object names.

    It seems to be holding on to a name that is no longer in use. I changed the name of the Macro in the folder, and I drag and drop the correct Macro into the appropriate field, but it is not actually changing.

    Closing Unity and re-opening, temporarily resolves this, but it ends up happening over and over again.

    None of my Events or Custom Event Triggers are firing, and I can't see any issue with them outside of this bizarre behavior.


    Even in this instance here - clicking on Roll in the Flow Macro window (which is incorrectly listed here), highlighted the correct 'player' Macro in the list on the left.
    upload_2021-8-10_19-33-13.png


    I even renamed it, from Roll to RollBackup - and it remains as 'Roll' and doesn't display the 'backup'.
    upload_2021-8-10_19-33-52.png


    Does anyone have any thoughts?
     
  4. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    Rebooted, updated Windows and Unity Hub, just because.

    That same field, from the post above, now shows correctly. Yay...
    upload_2021-8-11_13-40-1.png


    ... Until I click run, and it now reverts back to this. I made no other changes, aside from clicking Run and it turned back.
    upload_2021-8-11_13-41-56.png


    After stopping the game, the 'Roll' becomes irreplaceable again, where dragging in 'Player', does not change the 'Roll' value.

    What could be causing this? And is it actually looking for 'Roll', which no longer exists, and is that the reason it is no longer functioning properly?
     
  5. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    Which Unity version are you on?
     
  6. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    The file itself, as listed in the Unity Hub, shows as version 2021.1.12f1.

    Though, something I didn't notice until just today, is that when you mouse over the Unity icon on the Windows task bar, the hover pop-up says 2019.2.18f1 (64 bit).

    Not sure if that matters or not. Also using Bolt 1, not the newer 2.0.
     
  7. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    Bolt 1 is not officially supported past 2020.3 LTS. From 2021.1 and onwards you have to use Unity Visual Scripting which ships integrated within the engine and is accessible via Window/Visual Scripting.

    I'd believe the Unity Hub version more than the pinned taskbar one.
     
  8. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    Well that’s pretty interesting, thanks for the clarification.

    Im okay with rewriting from scratch, using this suggestion, as it isn’t a huge amount of work. But wanted to ask before just diving in, is there a way / can it convert existing Bolt into the valid VS21 content? No sense in wasting energy if it’s auto convertible.


    I feel silly. I’ve known to VS vs Bolt’, just didn’t think to force the transition to resolve my current concerns.
     
  9. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    I really don't understand what I am doing wrong anymore.

    I've transitioned out of using Bolt and am using only the built in Visual Scripting within 2021.1.12f1. I re-created everything in a new file, using the Mobile 3D template (versus just the normal 3D template from before).

    I created a single Script Machine / Macro for the 'Player' called 'PlayerScript'. Within that are all of the actions which use individual Events, tied to button clicks. All of this previously worked, and aside from installing PUN/Photon in a prior version of this file (which is not in this version of this file), I have made no changes to the Unity software or its components (or to the computer itself, outside of a normal Windows update).

    So the problem persists - On the 'Player Object', which is just a blank cube right now, I added a Script Machine component. To that, in the Graph section, I drag the script object named PlayerScript into the field. It immediately shows an Event name (in this case 'Use') versus is showing the PlayerScript file name.

    None of the button calls work, because the script itself (PlayerScript) isn't being called, it is looking for a script named 'Use', which doesn't actually exist, it is only the name of an event WITHIN the PlayerScript.

    I've uninstalled all other versions of Unity, aside from 2021.

    I'm getting pretty frustrated and really don't want to go down the path of uninstalling all of Unity, reinstalling it, and rebuilding for a 6th time, the same code in VS, just to face this specific issue again. I think it is something on my end, something I am doing wrong because I don't know any better - but if this is a technical issue, I'd love some advise.


    (Additionally, the 'Use' name that appears incorrectly... if I change the name of the PlayerScript, to PlayerScript2, that PlayerScript2 name automatically appears in place of the incorrect 'Use' name that was there. Changing Script2 to Script, also automatically updates. Clicking Play, reverts the correct name, BACK to 'Use'.)
     
    Last edited: Aug 15, 2021
  10. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    A GIF would help a lot in understanding the issue. ShareX is free and good for capturing them. Your issue doesn't sound like anything I've come across so far.
     
  11. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    I can't seem to add the ShareX here, but it put it in DropBox for me

    https://www.dropbox.com/s/s9ec6gvzr8n2y0e/tuprTX1Lec.mp4?dl=0

    This shows the PlayerScript being highlighted when clicking in the Script Machine window.

    Editing the name of the PlayerScript macro file itself, updates the Script Machine visual - but it still doesn't run and reverts right back on running or reloading the project.
     
  12. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    What's RollDice? Another macro graph located somewhere else?

    And are you on a non windows platform - Mac or Linux?

    Also, check the package manager. If you're on 1.5 of VS, update it to 1.6. You could also try to force the update to 1.7.3 by manually editing the package manager's manifest.json UnityVS version inside it.

    Then go to Project Settings/Visual Scripting and run the Fix Missing Scripts option.

    Have you tried removing and then adding the Script Machine component? Or resetting the current Script Machine component?
     
    Last edited: Aug 18, 2021
  13. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    No, the RollDice is a custom event within the PlayerScript flow machine macro.

    I just have that single script with a few actions tied to some UI buttons. OnClick of the RollDice button should trigger an event within the main PlayerScript.

    And I am using the latest official Windows 10 update/version. Automatic system updates, and manually checked.


    I will attempt the VS version and Json editing you suggested. I hadn’t checked the 1.6+ option yet, thanks.

    In terms of removing/re-adding, yes. I completely uninstalled all of Unity and rewrote it a few different times from zero, just assuming it was inexperience on my part. In addition to making edits and changes to the original/larger version when the issue first started. I have removed/re-added the component from the object. Renamed the script and the event names. For example, that RollDice event that is visible in error, renaming that to RollWhatever makes that new ‘whatever’ name appear in its place.

    It’s like the flow machine is reading the name of the events themselves, versus the name of the machines script.

    I’ll try the above and reply soon, thanks again.
     
  14. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
  15. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    I search for Manifest.json and a file in my project comes up, though it says this: 1.2.3.

    Is this the same thing you are referencing? It doesn't feel like it is because you say 1.5, 1.6, and this with 2021.1.17f only has 1.2, so I think I'm in the wrong manifest file.

    upload_2021-8-18_9-28-22.png

    I also ran the check, and it said there were no missing scripts fount.
     
  16. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    It should be:

    "com.unity.visualscripting": "1.7.3",

    In your UnityProjectFolder/Packages/manifest.json.

    If you open your package manager, do you see Visual Scripting package present in your project?

    Also, do you access the Graph editor Window via Window/Visual Scripting or some other way?
     
  17. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    Yes, it shows Visual Scripting 1.6.1, and I am not using anything custom on the IDE.

    When I manually update it to the right number in the file, save and load unity, I get an error saying it can't find that version / version is not available. I didn't grab that screen.

    Since our last post, I have completely uninstalled Unity and re-installed only the 2021.1.17f1 again. I have also done the Fixed Missing Scripts and Regenerate Units again. And even attempted to remove Visual Scripting and add the component back.

    Below are screen shots from a brand new file, made on the brand new install of Unity that I just made a few moments ago.

    It has a ground object, player object, camera, etc.

    I add the Custom Event, name it Roll. Button OnClick property, add the Roll event name. I hit Play and the 'PlayerScript' name in the Script Machine component, automatically changes from 'PlayerScript' to 'Roll' again.

    upload_2021-8-18_13-12-30.png

    upload_2021-8-18_13-12-55.png

    upload_2021-8-18_13-13-50.png

    Even the little line is squiggles instead of smooth.
    upload_2021-8-18_13-21-41.png
     
    Last edited: Aug 18, 2021
  18. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    Ah, I see what the issue is. You're renaming your PlayerScript graph with your On Click Unity event. "ScriptGraphAsset.name" literally changes the name of the graph asset.

    You need to use "ScriptMachine.TriggerUnityEvent" to trigger a Unity event inside a graph:

    Ji3DHvWEPI.gif

    To get "ScriptMachine.TriggerUnityEvent" you have to drag in the Player GameObject that has the PlayerScript graph attached to it from Hierarchy, NOT the graph asset from Project window. Graphs in Project Window are like templates and do not directly exist in the scene/game. You need an instance of the graph which you get from Hierarchy.
     
    Carcophan likes this.
  19. Carcophan

    Carcophan

    Joined:
    May 10, 2021
    Posts:
    79
    PanthenEye, I cannot express my appreciation enough. Thank you so very much.

    Your solution appears spot on and my once-working-now-broken file is working as it once was.

    There is a level of frustration here, that has literally brought a tear to my eye, learning the user-driven issue was something I did by accident and repeated every other time since then, without knowing it was wrong. I am so grateful and yet so very disappointed in myself. :)

    Thank you a million times over!!!
     
    PanthenEye likes this.