Search Unity

Question How to enable or disable a graph from another graph?!

Discussion in 'Visual Scripting' started by ahmedyaser7910, Nov 17, 2022.

  1. ahmedyaser7910

    ahmedyaser7910

    Joined:
    Jul 13, 2019
    Posts:
    3
    I want to disable my player movement graph according to some condition in other graph, i have been trying a lot of things but can't get it, i just want to know how to enable or disable a graph from another one or how to stop the graph editor window from toggling between game objects graphs because i found out a way to control graphs (script machines) into another game object's graph
     
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,068
    Typically, you'd do this via some kind of bool CanMove variable, then execute movement logic only when Player CanMove==true.

    Or you could set up a State Machine where player has two states - Moving and Idle/Talking/What ever. Then trigger state transition with UVS Custom Event.

    You can probably disable the graph by using GetComponent for ScriptMachine and disable that. But if Player GameObject has multiple ScriptMachine components, it'll only return one of them.