So im making a flood escape game and i wanted to see how many people escaped. So i made a script to see how many people steped on the block and escaped. But when i tried to put the script in the photon view it said this error “PhotonView Detected you dropped a Component missing IPunObservable Interface”. I have no idea how to fix it here is the script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class bob : MonoBehaviour {
public int players;
public Text text;
public PhotonView photonview;
// Use this for initialization
void Start () {
text.text = "you and " + players + "survived";
photonview = GetComponent<PhotonView>();
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(players);
}
else
players = (int)stream.ReceiveNext();
}
// Update is called once per frame
void Update () {
text.text = ""+players;
if (Input.GetKey(KeyCode.B))
{
players++;
}
}
}
,So im working on a flood escape game and I want to say how many people are alive. I made a script to see how many people steped on a block and escaped. But when I tried to put the script in the Photon view componet, it said this error “PhotonView Detected you dropped a Component missing IPunObservable Interface,”. Here is the script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class bob : MonoBehaviour {
public int players;
public Text text;
public PhotonView photonview;
// Use this for initialization
void Start () {
text.text = "you and " + players + "survived";
photonview = GetComponent<PhotonView>();
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(players);
}
else
players = (int)stream.ReceiveNext();
}
// Update is called once per frame
void Update () {
text.text = ""+players;
if (Input.GetKey(KeyCode.B))
{
players++;
}
}
}