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. Dismiss Notice

Question I want to know Is it possible?

Discussion in 'Scripting' started by unity_TR7C4xry9zxIAw, Dec 21, 2020.

  1. unity_TR7C4xry9zxIAw

    unity_TR7C4xry9zxIAw

    Joined:
    Jul 8, 2020
    Posts:
    26
    Hello, All

    I want to connect coroutine with button. If i pressed buttons, coroutine work and if I released buttons, coroutine not work. Now, I already make button and coroutine script. But I don't know how to write script that connected button. If you know this one, Could you tell me?
     
  2. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,192
    Code (CSharp):
    1. if (Input.GetKey(KeyCode.Space))
    2. {
    3.     // Call coroutine here
    4. }
    You probably need to be a little more specific of what you're looking for by providing your sample code.
     
  3. unity_TR7C4xry9zxIAw

    unity_TR7C4xry9zxIAw

    Joined:
    Jul 8, 2020
    Posts:
    26
    I modified this project(https://github.com/cre8ivepark/COVID19DataVisualizationHoloLens2), so i want to use button in scene, not the keycode.