Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Humanhoney · Dec 15, 2015 at 09:54 PM · networkingunity5asyncloadlevelasyncprogress-bar

Loading Progress using UNET

How to display loading progress while i'm using UNET. Here i have offline scene and online scene or maybe i switching scene and how to show loading progress?!

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AlanGreyjoy · Jan 01, 2016 at 08:45 PM 1
Share

I've looked. This is in the networkmanager class, but its not possible to get to it Network$$anonymous$$anager.s_LoadingSceneAsync = Application.LoadLevelAsync (newSceneName);

Hope other people have found a way to get to it :(

avatar image bsozay · Jan 11, 2017 at 08:44 PM 0
Share

@bittarello did you solved this problem that you faced ? Is that worked?

avatar image huulong · May 10, 2017 at 11:27 AM 0
Share

As @AlanGreyjoy said, Network$$anonymous$$anager.cs is already using LoadSceneAsync in ServerChangeScene and ClientChangeScene and is storing the loading operation in s_LoadingSceneAsync. It it used for the initial online scene (`StartServer`) and the final offline scene loading (`StopServer`), and also for online scene switching.

s_LoadingSceneAsync is static private but in theory accessible via reflection. $$anonymous$$aybe you can check s_LoadingSceneAsync.progress (and possibly set s_LoadingSceneAsync.allowSceneActivation = false if you need to) via reflection.

Oddly enough, s_LoadingSceneAsync.allowSceneActivation is set to true after checking s_LoadingSceneAsync.isDone, which should be redundant.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by snaildex · Mar 19, 2016 at 10:05 AM

Make your custom NetworkManager by deriving standart, then in OnStartServer and OnClientConnect events use SceneManager.LoadSceneAsync function to load scene, and then in event OnLevelWasLoaded check who is calling this event (server or client) and do smth - spawn etc. That worked to me to load battlefield in my game. And to display progress on clients just use asyncoperation returned by LoadSceneAsync like in offline games. Using only standart NetworkManager won't give you that result.

Comment
Add comment · Show 12 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bittarello · Jun 13, 2016 at 05:03 AM 0
Share

I'm trying this approach but when the host (I didn't try with other client) gets in the new scene, the network identity objects ,that were already spawned in the scene, stay disabled. Before I try this async load, with server level change it was working. I thought that client ready message was missing, but wasn't that. Do you have any solution?

avatar image snaildex bittarello · Jan 12, 2017 at 02:11 PM 0
Share

Read this: https://docs.unity3d.com/$$anonymous$$anual/UNetSceneObjects.html In short, when scene loaded, call on sever NetworkServer.SpawnObjects() to activate scene objects with network identity.

avatar image bsozay · Jan 11, 2017 at 07:53 PM 0
Share

@bittarello did you solved this problem that you faced ? Is that worked?

avatar image bittarello bsozay · Jan 11, 2017 at 09:41 PM 0
Share

yes, you have to tell to each client to change its scenes using async and sending the progress to the host. When all clients and host gets 0.9 of progress, the host tell everybody to change the scene locally. This loaded scene can't spawn the object when the host loads it. It needs to receive a message (you have to create one or using RPC) from clients telling they are in that scene. With all confirmation, you can call NetworkServer.SpawnObjects(). I hope it is it. Good luck.

avatar image bsozay bittarello · Jan 11, 2017 at 09:45 PM 0
Share

Thank you for your answer. I'll try it :)

Show more comments
avatar image ThaiCat · Jan 16, 2017 at 02:26 PM 0
Share

OnLevelWasLoaded() has been deprecated and will be removed in a later version of Unity. I guess it's not the best way to solve the issue. Futhermore, if i have more than 1 online scene, i should know which one to load in OnClientConnect(), how do i know that? I think i should receive scene message on clients before.

avatar image snaildex ThaiCat · Jan 16, 2017 at 10:45 PM 1
Share

Now you can use Scene$$anonymous$$anager.sceneLoaded event ins$$anonymous$$d of OnLevelWasloaded. I did not find any possibility to pass automatically additional data to client when connected, so yes, you need to do it manually by custom messages. And, since you have several scenes on server, ensure all your networkIdentities have correct sceneID (can be set manually by ForceSceneId method after scene loading) so they will appear only in specified scenes on clients. And don't think about Network$$anonymous$$anager as final solution - it was created for simple games/prototyping. Take a look at Unet components' source code, especially at Network$$anonymous$$anager to undrestand more, there is no magic: https://bitbucket.org/Unity-Technologies/networking

avatar image ThaiCat snaildex · Jan 16, 2017 at 11:00 PM 0
Share

I looked at unet sources and Network$$anonymous$$anager hoping that i could not derive anything from it and just rewrite it a bit, since overriding ClientChangeScene is impossible in derived classes, but, unfortunately there are some use of internal uNet functions, those can not be accessed that way. So i guess i have only two options: derive from Network$$anonymous$$anager and try to do smth dealing with all the limitations, or switch to using networktransport, which very likely will require to rewrite my network code (there is a lot).

Show more comments
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem with Application.Quit and Async networking 0 Answers

Async level load in 3.5 0 Answers

Loading Bar for Awake Function 1 Answer

Unity.Networking (UNet) RPC to Specific Player? Master Server? 4 Answers

TCP/IP Stream.Read doesnt work 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges