Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
0
Question by Schwartz_M · Jul 31, 2018 at 04:30 AM · networkingbasics

Some Basic Networking Questions

I've done plenty of research in the forums, I've done the tutorials and I've read through all of the UNET documentation. Nonetheless, I'm running into a multitude of errors at every turn, in trying to implement multiplayer networking. I've written down some basic questions that I can't find answers to, and maybe this will help me:
1. How does UNET handle objects that start from the Hierarchy? Are they automatically spawned on all clients and the server?
2. If I run a Server on Unity, and run a client from a Build of the game, will the error messages from the client appear in the Unity console? If I run Unity as a Host, will error messages from both server and client appear in the Unity console?
3. What exactly do isServer and isClient check for? I have one line of code that checks for “isServer” and is never true on any instance of my game, even though I have a server running. This script is attached to a game object that starts from the Hierarchy, which pertains to my first question.

Thank you for your time, if you do answer any of my questions.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by robochase · Jul 31, 2018 at 05:27 AM

I'll take a stab at these -

How does UNET handle objects that start from the Hierarchy? Are they automatically spawned on all clients and the server?

Yes, they will be automatically 'spawned' for both server & client. If you look at them in the inspector while the game is running, you'll see that the host player has automatically assigned it a net id and that should be the same net id for both server & client

2. If I run a Server on Unity, and run a client from a Build of the game, will the error messages from the client appear in the Unity console? If I run Unity as a Host, will error messages from both server and client appear in the Unity console?

Generally, error message in one instance of the game will NOT appear for other players. So like if player A has an Exception, the other players won't see it the Exception. Keep in mind that hitting an exception can generally cause the session to go sideways, so you may end up seeing errors of other kinds in other players' games once this happens.

Also, if you do make a client build, you can see error messages for that client automatically if you make a development/debug build. it's a check mark in Build Settings.

What exactly do isServer and isClient check for?

They pretty much do what is described in the documentation. isServer and isLocalPlayer have always been very accurate & reliable for me, so I'm not exactly sure what is going on. make sure your NetworkBehaviour'd gameobject also has a NetworkIdentity component on it. Also if you're loading the scene, you may want to make sure you do it the 'unet way'. I forget the exact details of this, but I think it may do some extra work to link up those NetworkIdentities when the scene finishes loading.

Comment
Add comment · Show 1 · 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 Schwartz_M · Jan 16, 2019 at 07:17 PM 0
Share

Thank you for answering my questions so well.

I'm still working on this project, and to anyone else reading this comment who has trouble with the isServer or IsClient flags, this was my problem: I was using those flags in the Awake() function on a script. It seems the flags are not yet set in Awake(), but if you use them in Start() they work as expected.

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

129 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What would be the most efficient way to host a dedicated server with the only purpose of storing uploaded strings? 0 Answers

Unity networking tutorial? 6 Answers

Basic Networking 1 Answer

Unity Multiplayer (Mirror) - Problem in syncing game object's variables across all clients. [Trying to send command for object without authority] 0 Answers

ScriptableObjects and SyncVars, is it posible? 1 Answer


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