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
0
Question by zak666 · Aug 09, 2016 at 04:51 AM · networkingscriptingbasics

Getting my Actual IP? (not 120.0.0.1)

Sup Again Gang! tr4ying to implement getting my IP Automatically so the player doesn't have to look it up! thought it would be nifty to have in the game for people who don't know what IP is or find it to confronting just to play a game however i keep getting (120.0.0.1) (LOCAL IP) NOT MY ACUAL IP ADRESS! is their a way to find a players TRUE IP so they don't have to google search every time they want to play my game? trying to use: but i just get the old LOCAL HOST IP not my actual IP.

 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 using UnityEngine.Networking;
 public class AutoFill_IP : NetworkBehaviour {
 
     // this script will Auto // Fill IP //
 
     public string AutoFill_My_IP = "";
     public Text IPAdress;
 
     // Use this for initialization
     void Start () {
         AutoFill_My_IP = NetworkManager.singleton.networkAddress;
         IPAdress.text = AutoFill_My_IP.ToString();
     }
     
     public void GetUIP_Button () {
         AutoFill_My_IP = NetworkManager.singleton.networkAddress;
         IPAdress.text = AutoFill_My_IP.ToString();
     }
 }
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 Arkaid · Aug 09, 2016 at 05:47 AM 0
Share

I guess you mean your public IP address? You usually need to hit an outside service that will return that for you.

There is an example here: http://stackoverflow.com/questions/3253701/get-public-external-ip-address

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Sherlore · Aug 09, 2016 at 07:22 AM

Have you tried using "Network.player.ipAddress"?

I used it to show my IP to hold network game. But if you have multiple IP, It will give you "one" of your IP.

For code example: public InputField ip;

 void Start () 
 {
     Debug.Log(Network.player.ipAddress);
     ip.text = Network.player.ipAddress;
 }


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

71 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

Related Questions

A simple tutorial to send an email 1 Answer

hi guys no idea why I'm getting error CS0117: `UnityEngine.MasterServer' does not contain a definition for `ipAdress' 1 Answer

How do I handle connection errors in a user friendly way? 0 Answers

Unity networking tutorial? 6 Answers

Camera switches player in network game 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