Help With Player Spawning

Options
OK so
1. Players Do Sucsessfully conect anf join a random room(or creat one if there isnt one)
2. I DO have the Photon View Script on ALL my Player Elements and guns(Anything that dynamicaly updates)
3. Networkmanager Script
[code2=csharp]using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour {

// Use this for initialization
void Start () {
PhotonNetwork.ConnectUsingSettings ("V.0.0.1");

}
void OnGUI () {
UnityEngine.GUILayout.Label ( PhotonNetwork.connectionStateDetailed.ToString() );
}
void OnJoinedLobby () {
PhotonNetwork.JoinRandomRoom ();
Debug.Log ("JOINEDLOBBY");
}
void OnPhotonRandomJoinFailed () {
Debug.Log ("CREATEDROOM");
PhotonNetwork.CreateRoom ( "MAIN" );
}
void OnJoinedRoom () {
Debug.Log ("JOINEDROOM");
PhotonNetwork.Instantiate ("Player", Vector3.zero, Quaternion.identity, 0) ;
}

}[/code2]

4. Players spawn in 3rd person but the camera is stuck looking at your own butt :-/ you can walk around tho is there a way to make ppl spawn in 1st person view?(Im new to Programming)

(Download http://fbe.am/qfJ )

Comments

  • That sounds like it's just an issue with your prefab.

    Bring a prefab into the world, check where the camera is on the prefab. If you've set it right and just didn't state that here, it may be that you are not disabling character components for the non-controlling players.

    So as an example from my project (this code will not copy paste and work):
    [code2=csharp]player = PhotonNetwork.Instantiate("Player", spawnLoc, spawnRot, 0);
    PhotonView photonView = player.GetPhotonView();
    if(photonView.isMine){
    MouseLook look = player.GetComponent<MouseLook>();
    look.enabled = true;
    Camera camera = player.GetComponentInChildren<Camera>();
    camera.enabled = true;
    MouseLook[] cameraLook = player.GetComponentsInChildren<MouseLook>();
    for(int i = 0; i < cameraLook.Length; i++){
    cameraLook.enabled = true;
    }
    }[/code2]

    Otherwise all players will control every player and all be using either the same camera or weird things with them since they have more than one camera enabled.
  • Ok so 2new problems
    1. My player prefab dosent move with me
    2. when i spawn my player prefab is SHOT acrosed the map and beyond.
  • If you think you can help add me on Skype: nerdy321
  • Ok so 2new problems
    1. My player prefab dosent move with me
    2. when i spawn my player prefab is SHOT acrosed the map and beyond.

    1. What constitutes "you"? is the camera moving around but not the player game object? If so your controller may be on the camera and not the player object. If your player is moving for the local player but not networked players then its an issue with your photonview being on the camera and not tracking the player from the sound of it.

    2. Is your prefab's position zeroed (on the actual prefab)? If the prefab has a transform position that isn't 0 it can make it spawn at that position relative to the spawn location you choose so check that first.

    So the other problem got fixed?