using System.Collections; using System.Collections.Generic; using UnityEngine; //НАДО НА СВЕЖУЮ ГОЛОВУ ЭТО ПОСМОТРЕТЬ ЭОТ ОТ ДИПСИКА public class ViewPrefabsProvider : MonoBehaviour { [SerializeField] private List mappings = new List(); private Dictionary prefabDictionary; public void Initialize() { prefabDictionary = new Dictionary(); foreach (var mapping in mappings) { if (mapping.prefab != null) prefabDictionary[mapping.id] = mapping.prefab; } } public GameObject GetViewPrefab(string id) { if (prefabDictionary.TryGetValue(id, out GameObject prefab)) { return prefab; } Debug.LogError($"Prefab with ID {id} not found!"); return null; } [System.Serializable] public class PrefabMapping { public string id; public GameObject prefab; } }