Author Topic: Do persistent channels auto load the level name for connecting players?  (Read 4008 times)

gg67

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 66
    • View Profile
I was messing around with LoadLevelAsync and passing null for the levelname (as you mentioned in another post) so I could handle my own level loading. However, it seemed that the channel was still loading the level name that the persistent channel was using. Do persistent channels treat joining differently than non-persistent channels?

Also, do you know the best way to use LoadLevelAsync (or additive)? From what I can tell, it still causes the fromLevel to freeze up when moving from fromLevel to toLevel. Do you have any experience with this? (I know it's not directly related to TNet).

Thanks

Edit: I noticed it's happening for any kind of channel. Does the server respond with the channel level name and use that to load it?
« Last Edit: February 11, 2014, 05:38:26 PM by gg67 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Do persistent channels auto load the level name for connecting players?
« Reply #1 on: February 11, 2014, 09:28:22 PM »
1. Join a channel with a null ID.
2. Once joined (OnNetworkJoinChannel received), TNManager.isActive = false, and Application.LoadLevelAsync (or additive -- better to do it via Additive).
3. Once everything finished loading (in some script's Start or Update function, ideally), TNManager.isActive = true.

Just a note... for this to work, all TNObjects must be already present by the beginning of stage 2, or your RFCs won't work.

gg67

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 66
    • View Profile
Re: Do persistent channels auto load the level name for connecting players?
« Reply #2 on: February 11, 2014, 09:35:02 PM »
So if I only pass null and don't do any of that other stuff, the correct level will still load because it's getting that info from the server?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Do persistent channels auto load the level name for connecting players?
« Reply #3 on: February 11, 2014, 09:40:22 PM »
If someone at any point used TNManager.LoadLevel with a level name, yes... it will.

The trick is to ensure that you never use it. Use Application.LoadLevel instead to switch levels yourself.