CD-ROOM/Assets/NavMesh/Examples/Scripts/SpawnPrefabOnKeyDown.cs
Gerard Gascón 341a877b4a init
2025-04-24 17:37:25 +02:00

13 lines
303 B
C#

using UnityEngine;
public class SpawnPrefabOnKeyDown : MonoBehaviour
{
public GameObject m_Prefab;
public KeyCode m_KeyCode;
void Update()
{
if (Input.GetKeyDown(m_KeyCode) && m_Prefab != null)
Instantiate(m_Prefab, transform.position, transform.rotation);
}
}