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 /
  • Help Room /
This question was closed Sep 10, 2015 at 08:27 AM by LinkoVitch for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by LinkoVitch · Sep 09, 2015 at 06:46 PM · networkingnetworkclient-server

Issuing SetClientReady causes duplicate network objects on local client

I am writing a client server game with UNet. I have created a working framework originally using NetworkManager class as a basis. I am now attempting to rework it without using NetworkManager.

At this point I have it mostly working, in that clients can connect to the host and pass messages back and forth reliably.

However, the local client is able to see the Hosts objects in the game scene. These objects are all spawned via NetworkServer.Spawn calls. This really becomes a problem when I issue a NetworkServer.SetClientReady message for the local client as it causes the local client to then spawn a local set of object instances. These obviously interfere with the ones on the host leading to some odd behaviour :)

Remote clients don't suffer this issue obviously and behave exactly as you would expect.

I am wondering if there is something I should be doing when spawning an object that is for the host, so that it doesn't appear on the local client's gamescreen?

Code snippet follows, this is all from my gameManager class. The hdl_ClientReady is called once my client sends a custom message to say that it is ready.

 void Start() {
         ClientScene.RegisterPrefab(tmpPlayerPrefab);
         netConfig = new ConnectionConfig();
         netConfig.AddChannel(QosType.Reliable);
 }
 
 void StartServer() {
         NetworkServer.Configure(netConfig,10);
         NetworkServer.Listen(7777);
 }
 
 private void hdl_ClientReady(NetworkMessage msg) {
 NetworkServer.SetClientReady(msg.conn);
 }
 
 void OnClientConnect(NetworkConnection c ){
   //....
   NetworkServer.Spawn(n);
 }
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

  • Sort: 
avatar image
0

Answer by LinkoVitch · Sep 10, 2015 at 08:27 AM

This was caused by the local client connecting to the host via IP and not the internal local client connection. (This is done using ClientScene.ConnectLocalServer() )

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

Follow this Question

Answers Answers and Comments

29 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

Related Questions

How should I verify that all of my client Object are created and ready after loading a new scene? 0 Answers

Adding Clients after Log in 1 Answer

NetworkServer.Send and NetworkClient.Send or synchronising on player prefab? 0 Answers

UNET - Both client and server player disappears for client after scene load 0 Answers

Synchronize scene loading networking 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