Author Topic: Loading screen when trying to connect?  (Read 2473 times)

Etarnalazure

  • Guest
Loading screen when trying to connect?
« on: September 03, 2013, 02:38:36 AM »
Hello again,

It's been a while. ^^
However, once more I find myself confused and in need of help.

I've recently tried to implement a loading screen for when people try and connect to the server
the reason for this is that my game world is getting rather large, so it usually takes 1-4 seconds to
join, and I'd like to show the users that the game is indeed still trying to connect.

However, I cannot find any options that allows me to check up on how far the progress has come
like there is with the inbuilt Unity networking.

So I'd like to ask if there is such a thing to help with this within TNet, or I've been wasting my time
:p (Since I cant very well use the "Application.GetStreamProgressForLevel" when I use the "TNManager.JoinChannel".. Or can I?)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Loading screen when trying to connect?
« Reply #1 on: September 03, 2013, 03:47:29 AM »
GetStreamProgressForLevel is for loading streamed levels in the web player, so I am not sure what it has to do with what you are trying to accomplish.

Still, nothing is stopping you from using that function. After all, TNet simply does Application.LoadLevel under the hood.

Etarnalazure

  • Guest
Re: Loading screen when trying to connect?
« Reply #2 on: September 03, 2013, 07:43:57 AM »
Ah, didnt actually know.

I followed the tutorial made by that M2H guy slavishly back when I first
tried playing around with the Unity networking.

I apologize for my stupidity, however i fear that this next question will only add
onto it;

Is there any functions within TNet that I can easily call to check if its still loading the level?
From what I can see theres a "TNManager.isTryingToConnect", however I dont think
thats what I need.

I'd very much like to use the processbar from NGUI to display how much of the level
has already been loaded.

I may just be overthinking it and should just look into making a loadbar as if it was a singleplayer
game, however I cant help but think I should add into the equation what is currently going on within
the game world, since a lot of the objects are inactive at the start, and slowly gets activates whilst
players play the game, this increasing the time for the game to actually load in.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Loading screen when trying to connect?
« Reply #3 on: September 04, 2013, 03:34:25 AM »
Scripts don't run while TNet is loading the level as it's done using Application.LoadLevel rather than LoadLevelAsync, so there is nowhere for you to check this status. The game is basically paused while the level is loading.

You can modify it to use LoadLevelAsync, and then it won't be paused, but it's a Unity question at this point, not TNet.

Etarnalazure

  • Guest
Re: Loading screen when trying to connect?
« Reply #4 on: September 04, 2013, 08:45:19 AM »
Right thank you for pushing me towards the right direction.
Now I know I need to stop looking through TNet's code and go and check out
the documentation for Unity.

As always, you've been a great help.