using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; // InputSystem 사용을 위해 추가 public class BaseScene : MonoBehaviour { List _activeObjects = new List(); void Start() { // "Prefabs/Test" 전체 경로를 사용하도록 수정 Manager.Pool.CreatePool("Prefabs/Test", 3); Manager.Pool.CreatePool("Prefabs/Player", 3); CreateJoyStick(); } void Update() { // Input System 방식으로 수정 if (Keyboard.current.aKey.wasPressedThisFrame) { Debug.Log("Pop !"); // "Prefabs/Test" 전체 경로를 사용하도록 수정 GameObject go = Manager.Pool.Pop("Prefabs/Test"); if (go != null) { go.transform.position = new Vector3(Random.Range(-5f, 5f), Random.Range(0f, 5f), 0); _activeObjects.Add(go); } } // Input System 방식으로 수정 if (Keyboard.current.sKey.wasPressedThisFrame) { Debug.Log("Push All!"); foreach (GameObject go in _activeObjects) { Manager.Pool.Push(go); } _activeObjects.Clear(); } } void CreateJoyStick() { GameObject joystick = Manager.Resource.Instantiate("Prefabs/UI/JoyStick", GameObject.Find("@Scene").transform); joystick.AddComponent(); } }