The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Why does PhotonStream not work?

Sinx
2022-02-21 20:01:50

hey i try to syncronize the color of my players which are random and

got these error messages and i have no clue on how to solve it.

Assets\Scripts\RandomColor.cs(25,18): error CS1061: 'PhotonStream' does not contain a definition for 'isWriting' and no accessible extension method 'isWriting' accepting a first argument of type 'PhotonStream' could be found (are you missing a using directive or an assembly reference?)

Assets\Scripts\RandomColor.cs(29,23): error CS1061: 'PhotonStream' does not contain a definition for 'isReading' and no accessible extension method 'isReading' accepting a first argument of type 'PhotonStream' could be found (are you missing a using directive or an assembly reference?)

Heres the code:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using Photon.Pun;

using Photon;

public class RandomColor : MonoBehaviourPun

{

public SpriteRenderer renderer;

public Color color;

void Start()

{

if(photonView.IsMine)

{

color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f);

renderer.color = color;

}

}

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)

{

if(stream.isWriting)

{

stream.SendNext(color);

}

else if(stream.isReading)

{

color = (Color)stream.ReceiveNext();

}

}

}

Thanks in advance :D

Comments

Tobias
2022-02-22 08:49:33

The error is a compile time issue. It has nothing to do with PUN itself.

IsWriting and IsReading needs to be uppercase.

Sinx
2022-02-22 13:18:55

omfg im so dumb. i looked at it soooooo often and compared it to the documentation.

how...

Thanks for pointing it out

Back to top