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

Hello,

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!

Best Answer

  • C_A_P_T_C_H_A
    Answer ✓

    😂


    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)

Answers

  • 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.

  • C_A_P_T_C_H_A
    Answer ✓

    😂


    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)