Create a gist now

Instantly share code, notes, and snippets.

@tsagara /GameObjectList.cs Secret
Last active May 3, 2016

What would you like to do?
GameObjectをぶちこんでおくだけコンポーネント
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class GameObjectList : MonoBehaviour {
[SerializeField]
private string name = "";
[SerializeField]
private string memo = "";
private int templateId = 0;
public List<GameObjectData> GameObjectList = new List<GameObjectData>();
public GameObject FindByName(string name)
{
if (GameObjectList == null || GameObjectList.Count == 0)
return null;
GameObjectData data = GameObjectList.FirstOrDefault(item=>item.name == name);
return data == null ? null : data.obj;
}
}
/// <summary>
//GameObject情報クラス.
/// </summary>
[System.Serializable]
public class GameObjectData
{
public string name;
public GameObject obj;
public string memo;
public GameObjectData(string _name, GameObject _obj)
{
name = _name;
obj = _obj;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment