Errors when re opening a room

Options
Hello, this question doesn't really have anything to do with pure code. I have a tank game. I can create rooms with any number of players and everything works at the first game. When the game is done though, the player as to click on a leave button. This button disconnect the player altogether from photon, send him back to the room screen, and reconnect him back to photon in order to display the rooms. Then, (after having done a party) when I'm trying to create a new one, i have a few errors popping up telling me scripts have been destroyed. Maybe I did destroy them at one point (big project) but everything should be resetting when disconnecting from photon, changing scenes etc right?So i don't really understand why do I have to re start my game to be able to start a party without errors. Could it be any cache issues or something?

Thank you.

Comments

  • gadoy
    Options
    I've understood that the problem is that when I'm changing of scene, my tank (with all views) is destroyed thus, causing problems.
  • gadoy
    Options
    I can't understand how can i avoid my tank being destroyed between scene changes? And is that even a thing?
  • gadoy
    Options
    Bump up, I can share my project if needed
  • gadoy
    Options
    I just found out, always add your raise event listener on awake, and ALWAYS remove on in an OnDestroy function
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited April 2020
    Options
    Hi @gadoy,

    Not "always" but it depends on the case and the expected lifetime of event callbacks/handlers.
    I'm glad you finally solved your problem and you did it on your own, even better.