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 LeopardX · Sep 28, 2015 at 06:40 AM · unity 5networking

Unity 5.2 SyncVar hook only gets called on host. VS debugger dosent debug it fully.

Basically i have a script that edits the location of a box, this box updates from host to client so they both see the box move, but on client to host it has no effect, on debuging the SyncVar Hook i made never calles the function, here is how its setup..

class ObjectUpdatePossition, is attached to the object that im trying to move.

 public class ObjectUpdatePossition : NetworkBehaviour
 {
 
 
     [SyncVar(hook = "value_changed")]
     private Vector3 syncpos;
 
     [SerializeField]
     float lerpRate = 15;
 
     // Update is called once per frame
 
     void value_changed(Vector3 value)
     {
 
               this.transform.position = value;
     }
 
     [Command]
     void CmdProvidePossitionToServer(Vector3 pos)
     {
         syncpos = pos;
     }
 
     [ClientCallback]
     public void TransmitPossition(Vector3 val)
     {
      
         CmdProvidePossitionToServer(val);
     
     }
 }


And then TransmitPossition is called from another class not attached to the object..

ObjectUpdatePossition xthis = //then the refrance to the object that has the ObjectUpdatePossition script attached to it.

     xthis.TransmitPossition(Vector3);

Im not entirly sure why the hook is not being called and thus dose not move the box, the TransmitPossition function works fine though and is called no probs..

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 LeopardX · Sep 27, 2015 at 01:46 AM 0
Share

It maybe that the VS debuger is not debuging it fully, because no matter which side i try to debug i cant caputre and see if it fires the hook

avatar image LeopardX LeopardX · Sep 27, 2015 at 03:17 AM 0
Share

turns out its just the vs debugger that dosent debug it fully, the syncvar calls the hook when at the host but dosent get called on clients.. still not sure why its got to be something simple.

avatar image LeopardX LeopardX · Sep 28, 2015 at 07:27 PM 0
Share

Damn even when i edit and make sure the [Command] is called on the player object, the client still dose not call it on the server.. is this a bug ??

I mean ive pretty much deter$$anonymous$$ed that the syncvar is not being set, becuase the Command is not being called at all on clients, even when as the documents say to only call Commands on the player object which ive done.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How To Send [Command] From Mouse Input Of The Local Player 1 Answer

Why Does Adding to My SyncListStruct Break SyncVar? 0 Answers

How do i share data between computers 0 Answers

OnServerStart not working in Build. Works in editor 1 Answer

uNet horrible lagg (even on local servers) 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