- Home /
What is the best way for Debugging (hitting breakpoints etc.) methods with the [Command] attribute in Networkbehaviour classes?
When I run a unity instance as 'LAN Host' everything is fine and my breakpoints will be hit. Unfortunately when I run one unity instance as 'LAN Server Only' and one instance as 'LAN Client' I cannot hit ANY breakpoints.
I would like to debug my 'Client' instance in specific. Is it possible to hit breakpoints in a method containing the [Command] attribute in my Networkbehaviour class?
Is this even possible? And if not, what should be a good way to debug this method for this specific 'Client' instance? (I tried to use Debug.Log but I din't found it very helpfull)
So all in all: What is the best way for Debugging (hitting breakpoints etc.) methods with the [Command] attribute in Networkbehaviour classes?
I'm using Visual Studio 2017.
Thanks in advance!
Answer by Bunny83 · May 22, 2017 at 04:43 PM
Methods with the "command" attribute are RPC methods. They aren't run on the client but on the server. You have to debug the server if you want to debug such a method. The client just sends an RPC command to the server and the server actually executes that code. So you can't debug it on the client as the client only sends off that command.
Is there a way to pick what unity instance (client or server) you want to debug?
Answer by cmdszh1 · Nov 13, 2019 at 09:49 PM
use Debug.Log to show [Command] and [ClientRpc] function. No matter your are host /client /or LanServer Mode. the low level api communication will not trigger the breakpoint in these functions.
Your answer
Follow this Question
Related Questions
Cannot debug errors created by Debug.Assert() 0 Answers
Are conditional breakpoints when debugging in VS2017 working for you? 2 Answers
UnityVS not breaking on exception and missing debug info 1 Answer
How to have step by step debugging in Visual Studio? 3 Answers
debugging multiple gameobjects with the same script 0 Answers