为什么ugui在unity生成预设体会变成540倍
1个回答
2016-08-31
展开全部
写脚本
采用单例模式
private CommandPanel instance;
public CommandPanel Instance
{
get {
if (instance == null)
{
instance = new CommandPanel();
}
return instance;
}
set { instance = value; }
}
public CommandPanel()
{
instance = this;
}
单例模式的构造函数一般为私有的,但是这里 只能通过共有方法构造当前实例;
public GameObject textNode;
public IDictionary<string, UnityAction<string>> textListDele;
public GameObject toggle; //预设 toggle
public Transform content; //正文
public RectTransform rectcontent; //正文大小
public GridLayoutGroup grid; //容器
采用单例模式
private CommandPanel instance;
public CommandPanel Instance
{
get {
if (instance == null)
{
instance = new CommandPanel();
}
return instance;
}
set { instance = value; }
}
public CommandPanel()
{
instance = this;
}
单例模式的构造函数一般为私有的,但是这里 只能通过共有方法构造当前实例;
public GameObject textNode;
public IDictionary<string, UnityAction<string>> textListDele;
public GameObject toggle; //预设 toggle
public Transform content; //正文
public RectTransform rectcontent; //正文大小
public GridLayoutGroup grid; //容器
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询