Photon 2 and Unity error CS0103: The name `PhotonNetwork' does not exist in the current context
Options
So trying out photon 2 and its a;ready broken from normal Photon XD
anyone know a fix?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon;
public class SpawnPlayer : MonoBehaviour {
public GameObject ShipSelect;
public Transform PlayerSpawn;
public Transform PlayerSpawn2;
public GameObject CameraUi;
public ShipSelect ShipSelectCS;
public GameObject ShipSelectCObj;
void Start (){
if (ShipSelectCS == null) {
Debug.Log ("NoShipSelectScript");
ShipSelectCObj = GameObject.FindGameObjectWithTag ("ShipSelect");
ShipSelectCS = ShipSelectCObj.GetComponent();
}
GameObject clone = PhotonNetwork.Instantiate (ShipSelectCS.ShipSelectedString, PlayerSpawn.position, PlayerSpawn.rotation, 0);
CameraUi.SetActive (false);
}
public void SpawnPlayerSP(){
GameObject clone = PhotonNetwork.Instantiate (ShipSelectCS.ShipSelectedString, PlayerSpawn.position, PlayerSpawn.rotation, 0);
CameraUi.SetActive (false);
}
}
anyone know a fix?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon;
public class SpawnPlayer : MonoBehaviour {
public GameObject ShipSelect;
public Transform PlayerSpawn;
public Transform PlayerSpawn2;
public GameObject CameraUi;
public ShipSelect ShipSelectCS;
public GameObject ShipSelectCObj;
void Start (){
if (ShipSelectCS == null) {
Debug.Log ("NoShipSelectScript");
ShipSelectCObj = GameObject.FindGameObjectWithTag ("ShipSelect");
ShipSelectCS = ShipSelectCObj.GetComponent();
}
GameObject clone = PhotonNetwork.Instantiate (ShipSelectCS.ShipSelectedString, PlayerSpawn.position, PlayerSpawn.rotation, 0);
CameraUi.SetActive (false);
}
public void SpawnPlayerSP(){
GameObject clone = PhotonNetwork.Instantiate (ShipSelectCS.ShipSelectedString, PlayerSpawn.position, PlayerSpawn.rotation, 0);
CameraUi.SetActive (false);
}
}
0
Comments
-
Check out Api changes and the Demo Project in Pun2.
And please use code formatting or upload ur script to hastebin.com.
https://doc.photonengine.com/en-us/pun/v2/getting-started/migration-notes.0