#Need Advice on Troubleshooting and Mirror Command not being Called

1 messages · Page 1 of 1 (latest)

dapper wyvern
#

Hello! I've been struggling with Unity Mirror's networking functions, specifically with the execution of commands. While the game runs smoothly in the Unity Editor, I'm facing difficulties when running the Mirror build. Despite the initial debug message appearing, the CmdDealCards command is never called, and subsequent parts of the code aren't triggered. I've checked the network setup, authority, and even added extensive logging, but the issue persists. Any insights or suggestions would be greatly appreciated!

I haven't gotten Mirror to work in about 4 months. And honestly at this point, I can't even remember if I ever had an instance of it working. To be a little more specific though, this is a 2D card game and I have the following code on a button:

public void OnClick()
    {
        Debug.Log("You clicked the button.");
        NetworkIdentity networkId = NetworkClient.connection.identity;
        PlayerManager = networkId.GetComponent<PlayerManagerScript>();
        Debug.Log(networkId.isOwned);
        PlayerManager.CmdDealCards(DrawAmount);
        DrawAmount = 1;
        UpdateTextbox();
    }

All of that executes just fine... but the CmdDealCards seems to never work. On the PlayerManager I have the following code:

[Command]
    public void CmdDealCards(int DrawAmount)
    {
        Debug.Log("You tried to create the card(s).");
        for (int cardNumberDrawn = 0; cardNumberDrawn < DrawAmount; cardNumberDrawn++)
        {
            //The rest of this doesn't matter.
        }
        Debug.Log("This triggered.");
        SortHand("Hand Area");
    }

The "You tried" Log never executes. It all works perfectly fine in single player using the Unity Editor. But as soon as there's a Mirror Build involved, it breaks. It seems to be a problem outside of the code, but I can't seem to find the answer, even with hours of asking ChatGPT.

Just so you know, this is my first Unity Project. I'm a total noob.

oblique bluff
#

also when you say build, what do you actually mean? you have 2 builds, one is a client, one is a server, or... ?

dapper wyvern
#

I check only if the Debug.Log messages show. When I test, I'm running a single mirror build, and clicking play in the unity editor. One's a host and client, the other just a client. That way, I can see the messages from one of the sides at least.

#

I don't know how to see error messages from a Mirror Build. And I'm not sure how to run two builds.

#

I can only get single player to work with the unity editor. The mirror build never works, with or without another connection.

#

And if means anything, the Mirror Build can never connect as just a client. Only connects as a host.

sour basin
#

Make sure you tick the check box "development" build then you can select the log you want to see from here.

dapper wyvern
#

Will check that when I get home 👍

dapper wyvern
#

With that enabled I can now see this error message:


UnityEngine.Debug:LogWarning (object)

Unity.Burst.Editor.BurstAotCompiler...```

Looking online doesn't yield many answers. Mostly, "Unresolved. Working on this in the next patch" - 4 years ago.

Idk, maybe I'm over looking something obvious. But I don't even know what Burst Aot is. Or like, if I can/should uninstall it?
wispy plume
#

honestly i think you have more issues than that could you screen the unity console?

#

also unless you use dots/ets/jobs i think you would need to remove burst from your project

#

and dependecies

#

but that warning probably ever comes from a unity bug with burst + test framework or it could be fixed even later on depending on unity versions i guess, that's just a warning and is irrevelant

#

since it's harmless

#

you probably have a command warning saying you don't have authority no?
since it looks like you use UI to send that command

dapper wyvern
#

I'm not sure. I'll definitely make a screen recording, to show what I see, but I don't think I'll have time today. Going out with friends right after work.

dapper wyvern
dapper wyvern
#

I'm not sure if I have some settings configured wrong, or maybe it's a firewall issue, but researching solutions to problems I'm not sure I have hasn't gotten me much progress.

If there's other parts I can/should show, let me know!

dapper wyvern
#

Some additional news:
The Unity Editor can't normally act as a host and have the Miror Build connect (it just refuses to). It can however, connect that way if the Mirror Build was already connected as a host, disconnects, and tries again the other way around.

When this happens, when the Editor can be a host, then some things are able to work. At least the Editor side can draw cards, and sort of see the cards that the Mirror Build draws.

wispy plume
#

what's those command warnings could you show the stacktrace

#

those on CmdMoveCard