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

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.

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.

"Caught exception in OnEvent() for event code 255" Error when trying to create a room only on build

2022-09-16 18:09:48


So i was making some stuffs that don't have anything to do with rooms creations/joins (a loadout system to have only 2 weapons at a time) and before i do this whenever a player created a room it worked perfectly fine, but now, it works in unity but not in the game's build where it makes this error : "Caught exception in OnEvent() for event code 255: System.NullReferenceException: Object reference not set to an instance of an object".

It does tell lines where the error occurs but it is in Photon's premade scripts.

Also when i try to recreate a room it makes another error : "CreateRoom failed. Client is on GameServer (must be Master Server for matchmaking) and ready. Wait for callback: OnJoinedLobby or OnConnectedToMaster.".

When i try to join a room instead of creating one, it makes this error "Failed to find a PhotonView with ID=3 for incoming OwnershipUpdate event (newOwnerActorNumber=1), sender=1. If you load scenes, make sure to pause the message queue." PLUS the first one. The room that the client try to join is one created in unity.

I really can't think of a solution so any help would be apreciated!


2022-09-21 08:39:20

Dang. Sorry, I deleted the message with the answer here. I thought it is a duplicated post and meant to remove one instance only.

If possible, please post again. I didn't check if there were open issues still.

2022-09-21 08:45:13


The answer was:

Ok turns out that i was having two instances of the same object that didn't control the same in the editor or the build (i have a MenuManager script that have a static variable called "instance" to reference itself in the awake method, but for testing a loadout system i putted another canvas with another MenuManager on it and for some reason in the editor MenuManager.instance is the main menu and in the build it is the loadout menu. So it didn't loaded the text field to choose a nickname and i suppose that Photon doesn't have a way to put players without name in a room)

(sorry if it was confusing)

Back to top