- 最后登录
- 2021-7-6
- 注册时间
- 2012-12-27
- 阅读权限
- 90
- 积分
- 76145
- 纳金币
- 53488
- 精华
- 316
|
using UnityEngine;
using System.Collections;
public class LevelManagerScript : MonoBehaviour {
private static LevelManagerScript _instance;
public static LevelManagerScript Instance
{
get
{
if (!_instance)
{
_instance = GameObject.FindObjectOfType(typeof(LevelManagerScript)) as LevelManagerScript;
if (!_instance)
{
GameObject container = new GameObject();
container.name = "LevelManagerScriptSingleton";
_instance = container.AddComponent(typeof(LevelManagerScript)) as LevelManagerScript;
DontDestroyOnLoad(container);
}
}
return _instance;
}
}
}
这段代码怎么转成JS的啊,我就改了他的语法,但是不可用····· |
|