Bob Donovan commited on
Commit
2d41831
·
unverified ·
1 Parent(s): 8155423

Fix Input System compatibility and missing AudioSource

Browse files

Switch from legacy Input to new Input System package API.
Add RequireComponent to ensure AudioSource is present.

Files changed (1) hide show
  1. RunJets.cs +3 -1
RunJets.cs CHANGED
@@ -2,7 +2,9 @@ using System;
2
  using System.Collections.Generic;
3
  using Unity.InferenceEngine;
4
  using UnityEngine;
 
5
 
 
6
  public class RunJets : MonoBehaviour
7
  {
8
  public ModelAsset modelAsset;
@@ -193,7 +195,7 @@ public class RunJets : MonoBehaviour
193
 
194
  void Update()
195
  {
196
- if (Input.GetKeyDown(KeyCode.Space))
197
  {
198
  TextToSpeech();
199
  }
 
2
  using System.Collections.Generic;
3
  using Unity.InferenceEngine;
4
  using UnityEngine;
5
+ using UnityEngine.InputSystem;
6
 
7
+ [RequireComponent(typeof(AudioSource))]
8
  public class RunJets : MonoBehaviour
9
  {
10
  public ModelAsset modelAsset;
 
195
 
196
  void Update()
197
  {
198
+ if (Keyboard.current.spaceKey.wasPressedThisFrame)
199
  {
200
  TextToSpeech();
201
  }