Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class spawnThePlayerNow : MonoBehaviour {
- public GameObject player1Prefab;
- public GameObject player2Prefab;
- public Transform spawnObject;
- public GameObject controlBundlePrefab;
- public GameObject devilPrefab;
- public GameObject spawnedPlayer;
- void Start(){
- spawnPlayer();
- }
- void spawnPlayer(){
- GameObject spawnThisPlayer;
- if(Network.isServer){
- spawnThisPlayer = player1Prefab;
- }
- else{
- spawnThisPlayer = player2Prefab;
- }
- spawnedPlayer = Network.Instantiate(spawnThisPlayer,spawnObject.position,Quaternion.identity,0) as GameObject;
- GameObject bundle = Instantiate(controlBundlePrefab,spawnedPlayer.transform.position,Quaternion.identity) as GameObject;
- networkManager.localPlayer = spawnedPlayer;
- bundle.transform.parent = spawnedPlayer.transform; //contains camera, background
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement