using UnityEngine; using UnityEngine.SceneManagement; using System.Collections.Generic; // 确保你的预制体都放在 Resources 文件夹下 public class BillboardManager : MonoBehaviour { void Start() { var targets = GameObject.FindGameObjectsWithTag("BillboardTarget"); foreach (var target in targets) { // 从 Resources 文件夹加载对应的预制体 string prefabPath = $"BillboardTextures/{target.name}_Billboard"; GameObject prefab = Resources.Load(prefabPath); Debug.Log($"Loaded prefab: {prefabPath}"); if (prefab != null) { Instantiate(prefab, target.transform.position, Quaternion.identity); target.SetActive(false); } } } }