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 am I getting a null?

playerDotName
2021-12-02 00:20:35


When my players join, I spawn characters for each of them. Occasionally, one instance of the game will not have a camera because no character has spawned. The instance this happens to registers the above error. I have no idea why that's happening and no idea how to begin to troubleshoot it.

Does anyone recognize this?

Comments

Tobias
2021-12-02 16:00:52

I think this is a part of code that we updated recently in PUN 2. If for some reason, the viewId could not be found, there is no view. So .. this will be null.

The cause for that, in turn, is likely you either failed to instantiate it or the game logic used a UnityEngine.Destroy() on a networked object. You want to debug if the object in question existed and if it did, why it doesn't anymore.

You could add logging to PUN or the objects to log when they get created and destroyed and which photonView.viewId they had.

When this happens, log the viewId in question and check your log and you might realize what's up.

Note: Loading scenes will also destroy GOs.

Back to top