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 gooncorp · Feb 27, 2012 at 12:33 PM · multiplayerserverclient

I need Help with Multiplayer I can server but not use client

I have some multiplayer code, and I know it works because I have confirmed it with other players who are using the same code. It's the generic code where you can type in your name, ip, and connect or host on the top left, im sure we all know which code im using.

I am trying to connect a client and a server locally on my computer. I have been able to host a server, but I cannot connect to the server locally with my client.

My default gateway is 192.168.2.1

When I try to host on 192.168.2.1 it lets me. When i try to connect on this same ip with another instance of the game as client, it will not let me do it. I have tried many different combinations of ips, ports, and clients. Nothing is working.

What am I doing wrong, this is really costing me a lot of time? Usually I can figure this stuff out on my own very easily but I have run into a BRICK WALL.

No i dont have firewalls, routers, nothing. All third party disabled. I just want to be able to connect my client and server instances locally on my computer. I am being as specific as I can without posting the generic code and telling you guys what my favorite color is.

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 Bunny83 · Feb 27, 2012 at 03:16 PM 0
Share

I'm a bit confused. Why do you tell use your default gateway? A gateway is a router and only necessary when you want to reach an IP outside of your local subnet.

You said you hosted your game on 192.168.2.1 but that looks like the IP of a FritzBox or any other router. Are you sure you know the IP of both PCs and that you use the correct one?

btw. Just to be sure: you talk about Unity's network engine (Raknet), right? In other words UnityEngine.Network.Connect() / InitializeServer()?

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Dreamside · Feb 27, 2012 at 12:50 PM

Are you running client from Unity itself or from a build? I just tried to do the same ,i build the game and create a server from unity itself and a client from my build.

In my second experiment i used local ip 127.0.0.1 and it also worked.

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

Answer by Bunny83 · Feb 27, 2012 at 01:45 PM

You propably forgot the most important thing for server-client applications in Unity:
You have to check Run-In-Background in the ProjectSettings or via scripting.

Otherwise the server can't process the connect of the client because it doesn't have the focus. When you switch over to the server it will process the connect, but the client doesn't react to that since the client is now in background.

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 gooncorp · Mar 02, 2012 at 12:15 AM 0
Share

bunny83 thank you so much. my multiplayer now works. i added the Application.runInBackground = true; to one of my start functions and presto.

avatar image
0

Answer by gooncorp · Apr 25, 2012 at 06:59 AM

thanks guys. yea it was the run in backround thing. i just realized someone had answered this. thanks again.

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

6 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

I have this script here for multi player and I cant seem to find the compiler errors. 1 Answer

Multiplayer Help? 0 Answers

Unity networking tutorial? 6 Answers

setup a php master server 2 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