Client player instantiating after starting level a second time

Options
Dear PUN users,

Me and a friend have made an online co-op platformer. We can create rooms, the second player can join the room and we can start the game. We can play the game until the end, after which we are returned to the main menu.
Now when we create a new room in the same game session and the second player joins again we see no problems.

When we launch the level the main player gets instantiated fine and on HIS screen, the second character also shows up.
On the second player screen it also switches to the level and he can see player one move but the second player does not get a character on his screen.

We fixed this by adding PhotonView.DontDestroyOnLoad() in our player script.

Now when we launch the level for a second time we can both see our characters and control them but the second player gets a lot of errors like : "The object of type... has been destroyed but you are still trying to acces it".
I does this for instance with our UI manager which is in the scene but it still can't find it.

Any suggestions or help is very much appreciated!

Answers

  • Romin
    Options
    It would be helpful if you can share the script