Sprit show on host

Hello, I have a problem with this course.
When the client creates tanks the sprite is displayed on the host.

I have tried a lot of things but I can’t find the solution.

I did a copy paste of the code on git but nothing changes.

Thanks in advance.


Hi there, sorry you are having trouble. Since the course was launched, Mirror changed the way renderers are handled and enables them all on start. Please change it so the OnSelect and OnDeselect activate and deactivate the gameObject holding the selection sprite instead of the selection sprite renderer. Then enable the sprite renderer and deactivate the gameObject in the prefab.

Hello ,thank you so much.

It works correctly


Continuing the discussion from Sprit show on host:

Can you explain why this makes it so that the sprite only appears on the host and not the client?

Mirror by default now sets all the renderers to enabled when the scene is loaded. So as the scene is loaded, all of the sprites are enabled and would show on all the clients and hosts. On the clients however, we have logic that sees they are unselected, and disables the renderers. Your local client does not expect to have other player’s units sprites enabled and does not check to see if their units are selected. So the sprites that don’t belong to the local client remained enabled.

In this specific context, the other player in the scene is the host. So the client sees the hosts sprites enabled, and doesn’t fix this. From the host’s perspective, It might be different. I can’t remember, but it could be the host is checking everyone’s units, since it has authority over all the units by default, and checking for selection and then setting the sprites accordingly.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.

Privacy & Terms