using UnityEngine;
using System.Collections;
using TNet;
public class PlayBTNque : MonoBehaviour
{
/// <summary>
/// Prefab to instantiate.
/// </summary>
public string prefabPath;
/// <summary>
/// Whether the instantiated object will remain in the game when the player that created it leaves.
/// Set this to 'false' for the player's avatar.
/// </summary>
public bool persistent = false;
IEnumerator Start ()
{
TNManager.JoinChannel (2, true, true);
while (TNManager.isJoiningChannel) yield return null;
TNManager.Instantiate (2, "CreateAtPosition", prefabPath, persistent, transform.position, transform.rotation);
Debug.Log ("Object created");
Destroy (gameObject);
}
[RCC]
static GameObject CreateAtPosition (GameObject prefab, Vector3 pos, Quaternion rot)
{
// Instantiate the prefab
GameObject go = prefab.Instantiate();
// Set the position and rotation based on the passed values
Transform t = go.transform;
t.position = pos;
t.rotation = rot;
return go;
}
}