Awake() private method

private Awake ( ) : void
return void
コード例 #1
0
ファイル: NetworkMockTest.cs プロジェクト: xibz/NoWriterIssue
        public IEnumerator Setup()
        {
            testObject = new GameObject();
            player     = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Tests/TestPlayer.prefab");

            testObject.AddComponent <kcp2k.KcpTransport>();
            // TODO: Add our own test transport
            kcp2k.KcpTransport transport = testObject.GetComponent <kcp2k.KcpTransport>();
            transport.Port = port;
            ((MonoBehaviour)transport).runInEditMode = true;
            Transport.activeTransport = transport;

            testObject.AddComponent <NetworkManager>();
            networkManager = testObject.GetComponent <NetworkManager>();
            SetupNetworkManager(networkManager);

            // we get the network id to lazy load the assetID on the NetworkIdentity
            NetworkIdentity id = player.GetComponent <NetworkIdentity>();

            if (id == null)
            {
                id = player.AddComponent <NetworkIdentity>();
            }

            networkManager.Awake();
            networkManager.StartHost();
            networkManager.Start();
            networkManager.LateUpdate();
            NetworkClient.Ready();

            yield return(null);
        }