- Home /
No Character Spawns / Screen Goes Black
No Character Spawns And The Game Screen Goes Black Why??????????
The Code Is: using UnityEngine; using System.Collections;
public class NetworkManager : MonoBehaviour {
public Camera standbyCamera;
SpawnSpot[] spawnSpots;
// Use this for initialization
void Start () {
spawnSpots = GameObject.FindObjectsOfType<SpawnSpot>();
Connect ();
}
// Update is called once per frame
void Connect () {
PhotonNetwork.ConnectUsingSettings ("V1");
}
void OnGUI () {
GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
}
void OnJoinedLobby (){
PhotonNetwork.JoinRandomRoom ();
}
void OnPhotonRandomJoinFailed (){
PhotonNetwork.CreateRoom (null);
}
void OnJoinedRoom (){
SpawnMyPlayer ();
}
void SpawnMyPlayer (){
if (spawnSpots == null) {
Debug.LogError("WTF??");
return;
}
SpawnSpot mySpawnSpot = spawnSpots[Random.Range(0,spawnSpots.Length)];
PhotonNetwork.Instantiate ("PlayerController",mySpawnSpot.transform.position,mySpawnSpot.transform.rotation,1);
standbyCamera.enabled = false;
}
}
Well i went to that site and it says you need a string for the prefab so I and very confused at what is wrong
It gets Too The bottom Of The Script Without A Problem But After That It Still Doesnt Spawn Anything or do anything it just joins the server then goes to a black screen in the game window
So the spawned object doesn't appear in the hierarchy either? Is the named prefab located in the resources folder? Docs said it must be. $$anonymous$$ake sure to read that section in full.
$$anonymous$$aybe you need to activate a camera attached to the object you're spawning?
It is in a resource folder within a prefabs folder within the folder that contains all of the other folders along with everything else.
How would I enable the camera when it spawns (Even Tho Nothing Gets Spawned) Even In The Seen
You'll drill down the prefab hierarchy until you arrive at the camera. Though if the camera's enabled in the prefab, I doubt you'll need to.
Answer by AlwaysSunny · Nov 09, 2014 at 09:59 PM
Use Debug.Log() statements to help determine where the problem is. Does the SpawnMyPlayer() method even execute?
Ensure you're following the Photon Networking docs for Instantiate() http://doc-api.exitgames.com/en/pun/current/pun/doc/class_photon_network.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613171122im_/https://answers.unity.com/themes/thub/images/avi.jpg)