Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

How to reference flow motion in C# script?

Discussion in 'Visual Scripting' started by ygh-jk, Oct 13, 2020.

  1. ygh-jk

    ygh-jk

    Joined:
    May 1, 2016
    Posts:
    6
    I'm not sure if this is the right place to post but what I'm trying to do is enable/disable the bolt component of a game object but I'm not sure how to do that in C#?
     
  2. Ex-Crow

    Ex-Crow

    Joined:
    Aug 14, 2020
    Posts:
    111
    Should work like any other component.

    Code (CSharp):
    1. var flowMachine = GetComponent<FlowMachine>();
    2. flowMachine.enabled = false;
     
    ygh-jk likes this.
  3. ygh-jk

    ygh-jk

    Joined:
    May 1, 2016
    Posts:
    6
    Yeah, that worked. Should've realized it when the component on the object is literally called Script lol. Thanks man!