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 /
This question was closed Jan 30, 2019 at 02:50 PM by tormentoarmagedoom for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by DarkT0mato · Jan 30, 2019 at 11:29 AM · networkingnetwork

Detect SinglePlayer mode in a Multiplayer game.

I have a multiplayer game, where 2 players can connect and play. I also want to add a Single-Player mode where the MaxConnections allowed is only 1 player. The problem is that the first player always joins by using "NetworkManager.singleton.StartHost();" and the second player joins by using NetworkManager.singleton.StartClient(); the problem is that when I set the MaxConnections to 1, it means max Client connections.. and doesn't count the Host (first player) as a connection. which mean that there still 2 players are able to connect into the single-player mode... Is there any way to set MaxConnections to 0? so no clients will be able to connect except the host? or just make the host Count as a connection. so it will not allow more connections from other clients? Thanks.

Comment
Add comment · Show 4
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 tormentoarmagedoom · Jan 30, 2019 at 11:43 AM 1
Share

Set it to 0...

You solved it!

avatar image DarkT0mato tormentoarmagedoom · Jan 30, 2019 at 12:39 PM 0
Share

First of all, I know what the code does. I know what host/client/server means. Secondly, you don't need any more information to help me with the problem. the problem is that unity Doesn't count The Hosting player as a connection. I gave 2 possible solutions in my question that I think might work. but I didn't find how to make them work. You probably the one who doesn't know code if you didn't understand the question.

avatar image tormentoarmagedoom DarkT0mato · Jan 30, 2019 at 02:50 PM 1
Share

Good day @DarkT0mato

Sorry for that, I delete every day several posts of "kids" posting about its huge problem when they dont even know what they are doing. Normally, a post without code or references is because the user pretend that we give him a completed and tested script to do what they need..

Congratz for solving the issue! Good luck!

Ps: I close the post.

Show more comments

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by DarkT0mato · Jan 30, 2019 at 02:29 PM

I solved the problem by setting the max connections number to 5 when its single-player. and in the online scene i just Check if the MaxConnections is 5, (which mean its single player mode). then i just disconnect any connected client except the host.

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

Follow this Question

Answers Answers and Comments

168 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 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

Problem with sluggish reactions in LAN game 1 Answer

How can I spawn a GameObject on all players in my multiplayer game? 0 Answers

Network rigidbody synchronize 0 Answers

Can i make multiplayer game without unity multiplayer service ? 1 Answer

Networking: multiple childs issue 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