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 tormentoarmagedoom · Jan 05, 2018 at 01:36 AM · networkingmultiplayerservermultiplayer-networkingclient

When a client click a Canvas button, does the server receive the info?

Hello.

I have some canvas that are spawned by the server with the player object. the problem I have is dont know why the server is not receiving the data i need.

The player clicks a button that executes a function in a script placed on it. This function is a [Command] funciton called Cmd.... this function only does one thing, increase a int variable like intVariable++;

The problem is that the script runing on the client is recieving that increase, but not the script runing on the server... what can be the problem? why the Cmd is not making the server to increase its variable?

Some sugestion? 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

2 Replies

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

Answer by tormentoarmagedoom · Mar 15, 2018 at 07:26 PM

Good day,

The solution is:

  1. Button executes a method_A in the client who made the click.

  2. This Method_A executes another Cmd_method_B in another script shared by clients and server that have Command Cmd property

  3. Cmd_method_B do all you need server to do, for example, execute a Client_Rpc_Method_C that will make clients to do something.

This way, a client (player) can click a button, which server knows that can make players to do something.

 If helped, please accept the answer :D


Comment
Add comment · Show 3 · 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 Ruby_and_Lucy · Apr 04, 2018 at 05:16 AM 0
Share

Hello,

I tried your solution, however, I received the following warning message: Trying to send command for object without authority., the Cmd_method_B was not called at all when I clicked the button.

avatar image tormentoarmagedoom Ruby_and_Lucy · Apr 04, 2018 at 06:25 PM 0
Share

This may be caused because you selected "client Authority" in the object containing the Cmd_method_B.

Or something like this. i mean, the "authority" options, are restrictive, so maybe you activated some authority in the wrong object

avatar image Ruby_and_Lucy tormentoarmagedoom · Apr 05, 2018 at 05:45 AM 0
Share

Hello,

Actually I tried both to select "client Authority" and deselect it, neither of them worked. I suspect the problem is because only the player can send Cmd_xx function to the server, and this is by design, whereas the button (the one which executes method_A) is not the player.

I checked the Unity doc, even though the commands can only be sent by the player, by assigning authority, non-player objects can also send commands. It means, the button must be assigned with client authority, it also means the button would become "networked". this is not what I want it to be, so I decide to redesign my program to bypass this problem.

avatar image
0

Answer by watercat · Mar 15, 2018 at 05:48 PM

alt textadd pls the input butons which has standalone input module to yours input butons this is toutorial https://unity3d.com/learn/tutorials/topics/user-interface-ui/creating-main-menu


test.png (20.7 kB)
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

144 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 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

Unity networking tutorial? 6 Answers

How can I call PhysX's simulate() and fetchResults() directly? 0 Answers

How to test Unity's new networking layer in separate game instances? 0 Answers

Why can't the client move a networked object ? 1 Answer

Do i need to have 2 seperate apps communicating for server/client relationship? 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