public void OnSpawn(NetworkMessage netMsg)
        {
            ViveNetworkSpawnMessage msg = netMsg.ReadMessage <ViveNetworkSpawnMessage>();

            GameObject spawnedObj = Instantiate(Resources.Load(msg.assetName)) as GameObject;

            spawnedObj.name = msg.objectID;
            spawnedObj.transform.position    = msg.position;
            spawnedObj.transform.eulerAngles = msg.eulerRotation;

            spawnedObjList.Add(spawnedObj);
        }
Пример #2
0
        public void AddSpawnMessage(string assetName, string objID, Vector3 position, Quaternion rotation)
        {
            ViveNetworkSpawnMessage spawnMsg = new ViveNetworkSpawnMessage();

            spawnMsg.assetName     = assetName;
            spawnMsg.objectID      = objID;
            spawnMsg.position      = position;
            spawnMsg.eulerRotation = rotation.eulerAngles;

            ViveShareMessage viveMsg = new ViveShareMessage();

            viveMsg.type = ViveShareMsgType.Spawn;
            viveMsg.body = spawnMsg;

            messageQueue.Enqueue(viveMsg);
        }