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 /
avatar image
0
Question by ComradeVanti · Mar 31, 2016 at 03:10 PM · networkingnetworkvariablespriterenderersync

Sync complex variables and components over network

Hey guys. So here is my situation.

I am making a multiplayer cardgame. On the beginning of the game 4 cards get layed on the field. The cards face down at the beginning (the prefab looks this way). Then I want to flip them. To do this I call a method on the card that rotates it half way, then changes the sprite to show the face of the card and then rotates the rest of the way.

This worked great on singleplayer but now it doesnt. The cards spriterenderer doesnt get synced to the clients. Only on the server the cards actually flip. The cards and the object that spawns them, aswell as the object that flips the cards exist on the server. I can see the cards rotate and move on the clients correctly, since they have a networktransform.

I have tried [SyncVar] on the renderer... nothing

I have tried [ClientRpc] and change the renderer in such a call but again... nothing. In this case the cards sometimes even dissapeared.

I should also mention that the flip method is a coroutine. Dont know if that is important.

If anybody could help me, that would be nice :)

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 ComradeVanti · Apr 02, 2016 at 11:09 AM 0
Share

I have done some more testing and came to the conclusion that the cards just dont really exist on the clients. On the clients I just see the bare prefab with only the transform being synced (NetworkTransform). So how do I get the gameobjects to actually exist on the clients?

Actually I dont care if there are copies of the server objects on my clients. I just want my clients to be able to see changes done to the objects on the server. As I said neither the Spriterenderer nor changes to the scripts get synced to the clients. Why? ;_;

Common guys. Pls help. :/

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by meat5000 · Apr 04, 2016 at 11:01 AM

You are taking the wrong approach.

You should solve this using Analogues.

An analogue is like "Linking by sight".

Instead of trying to send complex data, simplify it and sync the simple data.

Essentially you only need to send a float for a rotation, for example and let the client handle the SpriteRenderer by using that rotation value.

In order to get the most from the UNet system, you must read the Manual from start to finish as it deals with important concepts throughout. It is impossible to work it out from the scripting reference.

http://docs.unity3d.com/Manual/UNet.html

You dont want the server to literally control each how each client works directly. That is like playing a game from someone elses machine. You dont want the whole game sent across the internet.

You want the server to give small ques. The client picks up on these and then performs the operations itself based on that.

Put it this way... Each client already has ALL the information it needs to process the game. Its identical on server and client (under default UNet setup). So theres no need to be sending so much information. Its already got it. Just use little controls (of your own design if need be) of simple types to make this happen. Analogues.

Minimising bandwidth is essential in multiplayer gaming.

So you are not trying to control each sprite renderer directly from the server. The server simply gives a number based on where it wants the thing to be and the client reads that number and responds to it.

Am I making sense here?

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

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

Related Questions

syncvar not changing after command 0 Answers

How to sync a sprite changed at runtime using UNET? 1 Answer

Unity Mirror OnStartServer spawn GameObjects 1 Answer

Network Attributes details 0 Answers

Chat 5.5 synclist Stuck 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