Hey Guys,
I need help with my script. I dont now how Sync the Position of the Player with the Network.
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour {
private bool _isMultiplayer = true;
private bool _isNix = false;
private bool _isDiss = false;
private bool isEscapeMode = false;
public int a = 0;
public int b = 0;
public int c = 0;
public int d = 0;
public Transform spawnpoint;
void Start ()
{
Connect ();
}
void Update ()
{
if(Input.GetKeyDown(KeyCode.Escape))
{
_isDiss = !_isDiss;
}
}
void Connect ()
{
PhotonNetwork.ConnectUsingSettings ("Hallo");
}
void OnGUI ()
{
if (_isDiss) {
if (GUI.Button (new Rect (1665, 165, 236, 48), "Raum Verlassen")) {
PhotonNetwork.Disconnect ();
Application.LoadLevel ("Hauptmenu");
}
}
if (_isMultiplayer) {
GUILayout.Label
(PhotonNetwork.connectionStateDetailed.ToString ());
if (GUI.Button (new Rect (1665, 9, 236, 48), "Raum erstellen")) {
PhotonNetwork.CreateRoom ("Hallo");
}
if (GUI.Button (new Rect (1665, 113, 236, 48), "Zufällig")) {
PhotonNetwork.JoinRandomRoom ();
}
if (GUI.Button (new Rect (1665, 61, 236, 48), "Raum beitreten")) {
PhotonNetwork.JoinRoom ("Hallo");
}
if (GUI.Button (new Rect (1665, 165, 236, 48), "Raum Verlassen")) {
PhotonNetwork.Disconnect ();
Application.LoadLevel ("Hauptmenu");
}
}
if (_isNix) {
}
}
void OnJoinedRoom ()
{
PhotonNetwork.Instantiate("Player",spawnpoint.position,spawnpoint.rotation, 0);
_isMultiplayer = false;
_isNix = true;
}
}
Inpector Details : Imgur: The magic of the Internet