<code>public class GameLaunch:MonoBehaviour
{
public static GameLaunch _instance;
public static GameLaunch instance
{
get{
if (_instance == null)
{
GameObject go = new GameObject("GameLaunch");
DontDestroyOnLoad(go);
_instance = go.AddComponent<GameLaunch>();
}
return _instance;
}
}
}</code>
月度存档: 7 月 2019
unity MonoBehaviour也可以实现单例
作者: 朱坤乾
日期: 2019 年 07 月 19 日
没有评论
近期评论