Issues with server having other players units selected (visually)

Unity 2020.2.7 on Windows:


This image contains the server in editor, client in build. Client have spawned 2 units and deselected them.
I log who creates units. I have the sprite renderer on the selectionCircle on the unit off by default (as it should be).

I have also added logging when enabling/Disabling SpriteRenderer by adding a log script that I also call in the UnityEvents:

I also only call “onSelected” from client Select method (as shown in course):

    [Client]
    public void Select()
    {
        if(!hasAuthority) {return;}
        onSelected?.Invoke();
        Debug.Log("Client Select by: " + connectionToClient.connectionId);
    }

As seen in the first image, unit is spawned by server, the sprite renderer is turned on, but I don’t know why…

Anyone else had issues with SpriteRenderer being on on server for all non-server units?
Any idea on how to track this bug down?
Throw away the UnityEvents and handle the SpriteRenderer by code instead of inspector clicking?

Hi there,

I have seen a few people with this bug this week, what version of Unity and Mirror are you using?

Unity 2020.2.7f1 on Windows
Mirror Version: 32.1.4

Basically the latest version of both

See this solution:

I am going to recommend to everyone to enable and disable the gameObject instead of the sprite renderer directly until we have an official solution. This circumvents any issues with Mirror versions or changes to Mirror.

1 Like

Thanks. This solution is also more consistent with the rest of the course, where we enable and disable the gameObject for Health UI and GameOver screen.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms