Happy_Forest/Assets/Scripts/ManagerScript.cs
Pixel 1d2b4f3a0c Testing (First Script for Game Manager)
- added Folders for better Organisation
- added first GameManager Script for testing
2026-08-02 02:39:48 +02:00

35 lines
No EOL
856 B
C#

using UnityEngine;
public class ManagerScript : MonoBehaviour
{
[Header("Spawner Einstellungen")]
[SerializeField] private GameObject prefabToSpawn; // Ziehe hier dein Prefab im Inspector rein
[SerializeField] private Vector3 spawnPosition = Vector3.zero;
void Start()
{
SpawnObject();
}
void Update()
{
// Beispiel: Spawnen per Leertaste
if (Input.GetKeyDown(KeyCode.Space))
{
SpawnObject();
}
}
private void SpawnObject()
{
if (prefabToSpawn != null)
{
// Spawnt das Prefab an der Position spawnPosition mit Standard-Rotation
Instantiate(prefabToSpawn, spawnPosition, Quaternion.identity);
}
else
{
Debug.LogWarning("ManagerScript: Keinem Prefab zugewiesen!");
}
}
}