Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 XerosDylan · Mar 20, 2015 at 05:16 PM · networkingnetwork

Network.player.externalIP returning localIP

Hey there i'm just fooling around with the Network system of unity. And yesterday i was working on my laptop and made a connecting and hosting part and it would write my externalIP on the console. works perfectly builded it connected to the external ip of my laptop.

Now i'm on my work computer and i tried the same project on there though it doesnt seem to work at all it will either return my LocalIP or 'UNNASIGNED_SYSTEM_ADDRES'

Any help is appreciated tnx.

Things i've tried on my computer :

Opening port on router and Turning off firewall

Even tough my laptop has its firewall on and no portforwarded ports on it

How am i connecting / creating network

public void HostServer() { bool useNat = !Network.HavePublicAddress(); Network.InitializeServer(2, 25080, useNat); }

 void OnServerInitialized() 
 {
     Debug.Log ("Created on IP:" + Network.player.externalIP + " Port:" + Network.player.externalPort);
     Application.LoadLevel("LobbyMP");
 }

 public void JoinServer(Text text)
 {
     Network.Connect(text.text, 25080);
     Debug.Log (text.text);
 }

 void OnConnectedToServer()
 {
     //Connected to a server
     Application.LoadLevel("LobbyMP");
 }

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 XerosDylan · Mar 20, 2015 at 05:47 PM 0
Share

Tried a few times on my laptop turned firewall on and off.

  1. the one time it gives localIP the other time it returns externalIP (Network.player.externalIP)

  2. Tried connecting from laptop to pc i can connect locally but not trough externalIP i check with openportcheck tool to check if the port was opened and its not any help ?

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by ExtremePowers · Mar 20, 2015 at 05:19 PM

That might be because you are connected locally to the server. AFAIK You can't connect to your own server if it is on the same computer.

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 XerosDylan · Mar 20, 2015 at 05:23 PM 0
Share

Then how is it that my laptop does get its externalIP from itself and CAN connect to itself using its externalIP, And my computer cant ?

avatar image ExtremePowers · Mar 20, 2015 at 05:27 PM 0
Share

Have you tried on your laptop again, it could be something you changed in between..

avatar image XerosDylan · Mar 20, 2015 at 05:28 PM 0
Share

Yes i tried during the test on my computer and it still works on my laptop

avatar image
0
Best Answer

Answer by XerosDylan · Mar 20, 2015 at 06:15 PM

Asked a current Unity Developer on my skype list he got me some information about this and basicly to just get ExternalIP from myself would be doing the code below before starting the server.

Network.Connect("www.google.com"); string externalIP = Network.player.externalIP; Network.Dissconenct();

Also if i'd want people to connect to it they would have to port forward or i'd have to setup UPNP theres a asset called 'TNET' that does this for me.

Conclusion : If you want just LAN Multiplayer server this could be perfectly fine. If you'd wanna share it with online friends use a provider like Hamachi or Tunngle.

Making it with an externalIP means that the host player has to portforward

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

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

22 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

Related Questions

What is the CCU of the default Unity Networking? 1 Answer

Unity Web Request 2 Answers

How to Sync a sprite change to other clients? 0 Answers

Can I add a network prefab at runtime? 1 Answer

Instantiate By ID? 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