2026-04-22 모듈러 에셋 포함
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2023 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
public class GameObjectContainer : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private List<GameObject> gameObjectList = new List<GameObject>();
|
||||
|
||||
|
||||
private Dictionary<string, GameObject> gameObjectDict = new Dictionary<string, GameObject>();
|
||||
|
||||
protected void Awake()
|
||||
{
|
||||
// create dictionary.
|
||||
foreach (var obj in gameObjectList)
|
||||
{
|
||||
if (obj)
|
||||
{
|
||||
gameObjectDict.Add(obj.name, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(string objName)
|
||||
{
|
||||
return gameObjectDict.ContainsKey(objName);
|
||||
}
|
||||
|
||||
public GameObject GetGameObject(string objName)
|
||||
{
|
||||
if (gameObjectDict.ContainsKey(objName))
|
||||
{
|
||||
return gameObjectDict[objName];
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user