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
2
Question by hex21189 · Aug 28, 2018 at 03:47 AM · androidnetworkingmultiplayermultiplayer-networkinglan

PC Android LAN Network Connection

At the moment I am trying to create a networked game that works on both PC and Android (IOS to be supported later). The goal is to use mobile client devices as spectators for events while the main game plays out on the PC clients.


At the moment I have no issue networking between PCs and between multiple instances of a program run on the same PC. Using network discovery I am able to see connections broadcasted from PC hosts on Android clients but I am unable to connect. After a few seconds the connection times out and the connection message in the default Network Manage HUD is something like "connecting to local host...". Currently I am working with the sample program here as a base for the test. It should also be noted that PC clients are unable to find Android hosts when listening for broadcasts.


My current hunch is that somehow I need to open a port on the mobile device but I can't seem to find how to do this in Unity. It is important that this is done simply since Android users likely wont want to open settings to get the application to work. I've tried looking at a few tutorials for controllers however these seem to use the deprecated networking system which is no longer an option in my current Unity environment. Any advice or suggestions would be greatly appreciated. Apologize for being a bit vague but for legal reasons I can't or probably shouldn't post any code.

Comment
Add comment · Show 1
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 Wasplay · Nov 19, 2018 at 11:33 PM 0
Share

I have the same problem and I also want to do a game playing on the PC but using phones as controllers. I can't find any tutorial on how to do that, please tell me if you find a solution

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bioninja01 · Dec 10, 2019 at 04:28 AM

You might want to look here at this thread if you are still looking for an answer. He solution worked for me.

https://forum.unity.com/threads/solved-multiplayer-networking-lan-wont-connect-from-another-pc.470459/

@Joe-Censored said the following:

Localhost is your problem. You need to connect to the ip address of the host computer. localhost (which is the same as connecting to 127.0.0.1) means connect to the computer I am on. Run ipconfig or ifconfig on your host computer to see what IP address it is using, and on your clients you connect to that. If you are trying to connect with another computer over the internet it is far more complicated, where you'll need to log into your router and find its IP address and port forward to your host computer.

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 Llama_w_2Ls · Jul 22, 2020 at 04:43 PM 0
Share

This is not the issue. The link posted above helped and I was able to get the IP of my android device and connect my PC (the client) to my mobile device (the host/server) successfully. However, when in reverse (connecting my mobile device - the client - to my PC - the host/server), I was unable to get a connection. Is there something on android devices that doesnt allow the device to connect to a server. No connection occurs either way with two android devices either. I'm currently using $$anonymous$$irror to do my multiplayer, however $$anonymous$$irror, from my knowledge, doesnt support $$anonymous$$atchmaking, which the deprecated $$anonymous$$ultiplayer HPLAYI unity package did. If anyone has any tips on how to establish a connection between two android devices using $$anonymous$$irror, it would be gladly appreciated. Thanks!

BTW: This is the code for getting the IP of your device/PC, credit goes to some other guy on these forums:

         public string LocalIPAddress()
         {
             IPHostEntry host;
             string localIP = "";
             host = Dns.GetHostEntry(Dns.GetHostName());
             foreach (IPAddress ip in host.AddressList)
             {
                 if (ip.AddressFamily == AddressFamily.InterNetwork)
                 {
                     localIP = ip.ToString();
                     //IP.text = localIP.ToString();
                     break;
                 }
             }
             return localIP;
         }

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

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

How to set up LAN/Same Wi-Fi Multiplayer on Android? 0 Answers

Unity networking tutorial? 6 Answers

UNET: Host freezes when more than 6 players are connected. 1 Answer

Controlling a network game? 0 Answers

Unity NetworkTransformChild - Syncing the Child of a Child 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