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 ITEAnonymous · Mar 31, 2017 at 02:42 PM · networkingsynchronizationconnection

Network Send Server Data to Client and Vice Versa

 //On my server, I used InitializeServer to Start the Server
 Network.InitializeServer (10, 1234, useNat);    
 
 //On my client side to connect to the Server.
 Network.Connect("127.0.0.1", 1234);

Now, I want to send data to each other. For example, Server will send data to all clients, the count of clients connected. The client will accept that message and put the result in the UI Text.

I already read about NetworkMessage but It's only work if I used NetworkServer,Listen / NetworkClient.RegisterHandler. and also about [SyncVar] and [ClientRPC] but still I can't find my answer,

I'm hoping that somebody will help me about this. I just started learning about Unity Networking.

Source Code with a proper explanation will help, Unity Documentation made my head blow off.

Thanks in advance.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by toddisarockstar · Apr 01, 2017 at 01:36 AM

initialize.server is for creating a server and simply listening to a port. but unless you have setup a router to forward a port and set a PC to a static IP address, you have no way of the machines talking to each other without a master server first to get each others actuall addresses!

I think unity might still have a free test server. or i hear photon works well to set all that stuff up for you.

start googling "master server for unity".

Comment
Add comment · Show 2 · 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 ITEAnonymous · Apr 02, 2017 at 03:32 AM 0
Share

how about implementing game server hosted server online, then player to connect to that server what function is the best for this, the said photon can handle with this? thnx

avatar image toddisarockstar ITEAnonymous · Apr 02, 2017 at 02:32 PM 0
Share

photon is very popular here. it's server space that is setup just for unity. it's pry just what you need. after you install the photon package, they have their own functions / commands you call in your scripts. so you would say things like: PhotonNetwork.Connect(blah,blah); they would also give you commands to get listings of other users waiting to join a game and things like that.

last i heard. photon is free to setup. If your game is successful, I would guess the free version has some limit on how much traffic or how many users can connect before you gave them a fee.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to fix this: OnObjSpawn netId: 1 has invalid asset Id UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate() ? 2 Answers

How to display connections count on client 4 Answers

Network and GUI, moving objects from server not updating on client, but updating on host 0 Answers

Multiplayer - Parent's children not syncing 0 Answers

Spawing Hololens Camera OR ARCamera at user defined spawn locations 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