Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Player won't spawn with PUN

$
0
0
I am new to this, so sorry if i am leaving out info or i sound like a noob.

Hello, recently i have been following "image" this tutorial pretty much exactly however i am using the built in Unity FPSController. After following the tutorial, i was met with a few problems. Bearing in mind i have no errors that are popping up, but when i click play nothing happens at no so no player spawns, which i found really weird. I tried to tick the box "AutoJoin Lobby" I heard that helped in some cases but for me it didn't and I have been having this issue for a while now. Any help what so ever will be greatly appreciated. Thanks for your time.

This is the script i used, but again apparently there is no errors.

using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour {
const string VERSION = "v0.0.1";
public string roomName = "VVR";
public string playerPrefabName = "FPSController";
public Transform spawnPoint;

void Start () {
PhotonNetwork.ConnectUsingSettings(VERSION);
}

void OnjoinedLobby() {
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 4 };
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);

}



void OnJoinedRoom() {
PhotonNetwork.Instantiate(playerPrefabName,
spawnPoint.position,
spawnPoint.rotation,
0);
}
}






I also created 2 empty's one for a spawn point and one for a network manager which i assigned this script too and then i assigned the spawn point transform to it too.


Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>