Author Topic: Load new scene without leaving current channel  (Read 8077 times)

fgame

  • Guest
Load new scene without leaving current channel
« on: December 12, 2013, 01:39:54 AM »
Can we load new scene on client while still connecting to current joined channel?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Load new scene without leaving current channel
« Reply #1 on: December 12, 2013, 06:29:01 AM »
You can. Many people specify 'null' for the scene name for JoinChannel so that they can load the level afterwards themselves.

fgame

  • Guest
Re: Load new scene without leaving current channel
« Reply #2 on: December 12, 2013, 08:27:39 PM »
You can. Many people specify 'null' for the scene name for JoinChannel so that they can load the level afterwards themselves.

When you are already connected to a Channel, and then you load other scene in client, it will auto leave current channel. How to overcome it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Load new scene without leaving current channel
« Reply #3 on: December 13, 2013, 05:56:20 AM »
Problem with loading a new scene is that your game objects get destroyed, so that whatever TNObjects you had in the scene will no longer be valid. You have to be extremely careful when doing this yourself.

You need to use Application.LoadLevel instead of TNet's method when you want to switch the scene locally, and not globally.

fgame

  • Guest
Re: Load new scene without leaving current channel
« Reply #4 on: December 13, 2013, 08:15:45 AM »
Problem with loading a new scene is that your game objects get destroyed, so that whatever TNObjects you had in the scene will no longer be valid. You have to be extremely careful when doing this yourself.

You need to use Application.LoadLevel instead of TNet's method when you want to switch the scene locally, and not globally.

So is that impossible to remain in the channel when load another scene?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Load new scene without leaving current channel
« Reply #5 on: December 13, 2013, 09:56:54 AM »
Eh? I just told you how to do it.

By default Unity unloads everything (destroys everything) in the previous scene before loading the next. You can change this on certain objects by using DontDestroyOnLoad. However if you simply switch to another scene without doing anything else, all your objects will be gone. This is just how Unity works.

Rogdor

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Load new scene without leaving current channel
« Reply #6 on: December 13, 2013, 10:34:12 AM »
I use just one channel, with both LoadLevel and LoadLevelAsync and I can verify it works just fine.

pyscho2day

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: Load new scene without leaving current channel
« Reply #7 on: December 13, 2013, 10:42:54 AM »
Aren,

In your adventures would it be possible to add a TNManager.LoadLevelAsync option.  Reading this thread made me think of that.  Seeing as right now the whole screen locks up when TNManager.LoadLevel is called (and expected) but it would be nice to have an active load screen vs a passive(static) screen.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Load new scene without leaving current channel
« Reply #8 on: December 13, 2013, 05:57:35 PM »
Not a bad thought. I'll add it.