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 /
  • Help Room /
avatar image
1
Question by Sanyika66 · Mar 25, 2016 at 01:06 PM · networkingmultiplayerlanip

How to set hosts IP

So, I made a 2D game with the basics of Roll-a-Ball and Multiplayer Networkig tutorials.

The problem is: on one-computer (two clients: one is the host) it works fine, but my friend cant connect to me. I think the problem is that the NetworkManagerHUD always reads the address as "localhost" and port "7777". Can I change it? And how?

Oh, I know how to change it, but in-game? Or can I add a button to change it?

Comment
Add comment · Show 2
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 meat5000 ♦ · Mar 25, 2016 at 11:12 AM 0
Share

localhost is always 127.0.0.1

You can simply click the box and put a new IP address in, in the build.

First attempt to connect between the editor and a standalone on the same system. If this fails its usually firewall/router related.

avatar image Sanyika66 meat5000 ♦ · Mar 27, 2016 at 06:04 PM 0
Share

Thanks fr the answers, but I already know how to set the address and port in the editor. I just need to change it in-game or something like that. I think you used in your life at once the Network$$anonymous$$anagerHUD, you can type an address to connect to. But in.game, I need to change it, not in the editor. Also, in the editor I tried modifying the IP, with a friend and it did not work. Firewall is off, and I'm stupid in router related things, like "forwarding".

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by thegreatzebadiah · Apr 27, 2016 at 09:56 PM

You can change the address that the NetworkManager connects to by setting networkAddress in your code any time before the call to StartClient(). You shouldn't need to set it on the host.

You're still going to have trouble connecting to any host behind a router though due to those pesky "forwarding" issues. You have two options.

Option 1 is to use Unity's expensive relay servers. That means you'll need to use unity's matchmaking stuff. NetworkMatch.CreateMatch() / NetworkMatch.ListMatches() / NetworkMatch.JoinMatch(). Then instead of setting NetworkManager.networkAddress you just pass the match info JoinMatch() to connect.

Option 2 is some sort of NAT traversal solution that will handle port forwarding / punch-through automatically. I recommend my plugin that you can get on the asset store: https://www.assetstore.unity3d.com/en/#!/content/58948 In that case you won't have to worry about creating or joining matches. You just call StartHostAll() to start hosting. You pass the host IP into StartClientAll() to connect. Everything else is handled for you behind the scenes. Ports are forwarded automatically on the host's router, and if that doesn't work there's some complicated puchthrough magic that happens that will usually (85-95%) succeed in connecting players directly. If all else fails you can optionally still fall back to using Unity's relay servers which work 100% of the time (but are expensive).

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 Sanyika66 · Aug 23, 2016 at 10:11 AM 0
Share

actually, thanks for answering.

only probelm is i used unity at least 2 months ago, yesterday i downloaded the new update, and everything was weird. so i currently taking another nap.

anyways thanks again and if i get out of my laziness a will read your comment again

avatar image
0

Answer by yafo_unity · Aug 22, 2016 at 07:10 AM

hey, Buddy,How do you solve this problem in the end?

Comment
Add comment · Show 3 · 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 Sanyika66 · Aug 23, 2016 at 10:12 AM 0
Share

check out my other comment on thegreatzebadiah.

basically i didnt solve it. if i will able to get a working multiplayer (i and my friend 100km away) i will post what i did.

avatar image Chrubgamer · Aug 11, 2020 at 09:25 AM 0
Share

@Sanyika66 Famous last words XD

avatar image Sanyika66 Chrubgamer · Aug 11, 2020 at 10:28 AM 0
Share

you thought i was gone, eh?

well, indeed i stopped program$$anonymous$$g/trying to come up with a simple game idea, but yeah the deal still holds, if it works imma post it (also i was a little stupid back then in 2016, forgive my english)

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

7 People are following this question.

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

Related Questions

Card Game using Network Manager 0 Answers

How do I set an object to be used by a player, and a separate object for the second player via Multiplayer or Lan? 0 Answers

Can i get names of some free LAN multiplayer assets?? 0 Answers

Designing a multiplayer lobby for LAN 1 Answer

LAN on iOS without manually entering IP when connecting 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