34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
public class SceneSetup : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform groundPlanePrefab; // Transform của Prefab Plane
|
|
[SerializeField] private Transform amrPrefab; // Transform của Prefab AMR
|
|
|
|
void Start()
|
|
{
|
|
// Khởi tạo Plane
|
|
if (groundPlanePrefab != null)
|
|
{
|
|
GameObject plane = Instantiate(groundPlanePrefab.gameObject, groundPlanePrefab.position, groundPlanePrefab.rotation);
|
|
plane.name = "GroundPlane";
|
|
Debug.Log($"Đã khởi tạo GroundPlane Prefab tại position: {groundPlanePrefab.position}, rotation: {groundPlanePrefab.rotation.eulerAngles}");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("GroundPlane Prefab (Transform) chưa được gán trong Inspector!");
|
|
}
|
|
|
|
// Khởi tạo AMR
|
|
if (amrPrefab != null)
|
|
{
|
|
GameObject amr = Instantiate(amrPrefab.gameObject, amrPrefab.position, amrPrefab.rotation);
|
|
amr.name = "AMR";
|
|
Debug.Log($"Đã khởi tạo AMR Prefab tại position: {amrPrefab.position}, rotation: {amrPrefab.rotation.eulerAngles}");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("AMR Prefab (Transform) chưa được gán trong Inspector!");
|
|
}
|
|
}
|
|
} |