押している間~ならGetKeyで取れば良いですし、押したら動き始めるスイッチみたいなのを想定しているならboolでそのオンオフを取れば良いです。
Input.GetKey
https://docs.unity3d.com/jp/460/ScriptReference/Input.GetKey.html
cs
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public class Test3 : MonoBehaviour {
6
7 bool hoge;
8
9 void Update() {
10
11 if (Input.GetKeyDown(KeyCode.Space)) { hoge = !hoge; }
12 if (hoge) { Debug.Log("fuga"); }
13
14 }
15
16}
17
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。