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 Fadi · Aug 03, 2013 at 11:45 AM · multiplayerserverclientjoin

Multiplayer - Can't Connect Me ?

Hi...

I created a MultiPlayer game .

when my friend create a game I can join him directly , but when he trying to join my created game , it's not working.

I think the problem from my PC ( Antivirus Or FireWall ) , but am not sure.

please any idea where is the problem and how can I fix it ?

thank you :)

Comment
Add comment · Show 3
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 bompi88 · Aug 03, 2013 at 07:34 PM 0
Share

Need more information of how the multiplayer part is scripted and physically set up. Do you have a master server? On the same network etc.?

avatar image Fadi · Aug 03, 2013 at 09:48 PM 0
Share
     function StartServer(ServerName:String ,ServerPassword:String ,$$anonymous$$axPlayers:int)
     {
     $$anonymous$$atchName = ServerName;
     $$anonymous$$atchPassword = ServerPassword;
     $$anonymous$$axPlayersCount = $$anonymous$$axPlayers;
     Network.InitializeServer($$anonymous$$axPlayersCount, NetworkPort , true); // false = Not useing internet
     $$anonymous$$asterServer.RegisterHost(RegisterHostName,$$anonymous$$atchName,"");
     }
      
     function OnServerInitialized()
     {
     Server_PlayerJoinRequest(PlayerName,Network.player);
     }
      
     function OnConnectedToServer()
     {
     networkView.RPC("Server_PlayerJoinRequest",RPC$$anonymous$$ode.Server,PlayerName,Network.player);
     }
      
     @RPC
     function Server_PlayerJoinRequest(PlayerName : String , view : NetworkPlayer)
     {
     networkView.RPC("Client_AddPlayerToList",RPC$$anonymous$$ode.All,PlayerName,view);
     }
      
      
     @RPC
     function Client_AddPlayerToList(PlayerName : String, view : NetworkPlayer)
     {
     // If there same name //
     for ( var pl : $$anonymous$$PPlayer in PlayerList)
     {
     if ( pl.PlayerName == PlayerName)
     {
     PlayerName = PlayerName + Random.Range(1,250);
     }
     }
      
     var tempplayer : $$anonymous$$PPlayer = $$anonymous$$PPlayer();
     tempplayer.PlayerName = PlayerName;
     tempplayer.PlayerNetwork = view;
     PlayerList.Add(tempplayer);
      
     Player$$anonymous$$anagerPrefab.name = PlayerName;
      
     if ( Network.player == view )
     {
     $$anonymous$$yPlayer = tempplayer;
     var play : GameObject = Network.Instantiate(Player$$anonymous$$anagerPrefab,Vector3.zero, Quaternion.identity,5) as GameObject;
     play.name = PlayerName;
     $$anonymous$$yPlayerObject = play;
     }
     }
      
     function OnPlayerConnected(player : NetworkPlayer)
     {
     for ( var pl : $$anonymous$$PPlayer in PlayerList )
     {
     networkView.RPC("Client_AddPlayerToList",player,pl.PlayerName,pl.PlayerNetwork);
     }
      
     networkView.RPC("Client_Get$$anonymous$$ultiplayer$$anonymous$$atchSettings",player,Current$$anonymous$$ap.$$anonymous$$apName,"","");
     }
      
     function OnLevelWasLoaded ()
     {
     if (Application.loadedLevelName == Current$$anonymous$$ap.$$anonymous$$apLoadName && Network.isServer)
     {
     $$anonymous$$atchLoaded = true;
     Spawnpoints = GameObject.FindGameObjectsWithTag("spawnpoint");
     networkView.RPC("Client_ServerLoaded",RPC$$anonymous$$ode.AllBuffered,If$$anonymous$$atchStarted);
     }
     }
   
avatar image Fadi · Aug 03, 2013 at 09:50 PM 0
Share

it's work fine when I connect to other PC , but when friends trying to connect my PC it's not working....

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by WizzDE · Aug 03, 2013 at 09:47 PM

Check if...

  • you forwardted the right port on your router

  • he is using your public ip (google for myip)

  • your/his firewall isn't bloking your game

  • you didn't made any codding mistakes

hope I helped!

Wizz

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 Fadi · Aug 05, 2013 at 06:14 PM 0
Share

Thank u , are there any thing I can do it by program$$anonymous$$g , like let the firewall don't stop my game , or any thing else .

note : some times my friend can join me even I create the game.

that's really weird, Why some times work and other don't ?

avatar image Fadi · Aug 08, 2013 at 10:58 PM 0
Share

any idea ?

avatar image Bunny83 · Aug 08, 2013 at 11:06 PM 0
Share

The point of a firewall is to block programs from unauthorized usage of the network. You can't "allow yourself" that would make the firewall pointless. Also if you're behind a NAT router (which you propably are) that doesn't "support" / allow NAT punchthrough, you need to forward the port you're using to your PC. That's all external problems which are not related to your application and therefore can only be solved outside your application.

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

18 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

Related Questions

Unity networking tutorial? 6 Answers

attached prefabs before client joins 2 Answers

Why can't the client move a networked object ? 1 Answer

Multiplayer - sending a variable from server to client 1 Answer

Player falls through plane/floor (Multiplayer) 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