public void OnLoginClick() { print("Login! Account = " + Account); gameObject.SetActive(false); GameObject prefab = (GameObject)EditorEnv.LoadMainAssetAtPath("Assets/Prefabs/Game.prefab"); GameObject go = (GameObject)Instantiate(prefab); go.transform.SetParent(transform.parent, false); }
void OnLoginClick() { print("Login!"); gameObject.SetActive(false); GameObject prefab = (GameObject)EditorEnv.LoadMainAssetAtPath("Assets/Prefabs/Game.prefab"); GameObject go = (GameObject)Instantiate(prefab); go.transform.SetParent(transform.parent, false); Transform te = go.transform.FindChild("TestEntry"); te.gameObject.AddComponent <jsb.Test.Logic.TestEntry>(); }
void Start() { // 这个函数是一个演示,他是整个应用程序的入口 // 逻辑代码不能直接在Inspector中挂上去,那么总得有一个入口点,就是这里 // // GameObject prefab = (GameObject)EditorEnv.LoadMainAssetAtPath("Assets/Prefabs/Login.prefab"); GameObject go = (GameObject)Instantiate(prefab); go.transform.SetParent(transform, false); #if JS Instantiate(AssetDatabase.LoadMainAssetAtPath("Assets/Scripts/JSBinding/_JSEngine.prefab")); JSComponent jsComp = go.AddComponent <JSComponent>(); jsComp.jsClassName = "Login"; jsComp.jsFail = false; jsComp.init(true); jsComp.callAwake(); // 要调用 js 的 Awake #else go.AddComponent <Login>(); #endif }