I am currently working on a game in defold. Its one of those country games. But I have a problem/bug in it that makes no sense to me and have been unable to fix. In my game whenever you hover your mouse over a country it will show the name of the country and what continent it is in. Here is a picture:
In the picture it seems normal, but for some reason the hover sprite will sometimes go behind the country. Sometimes when I run the game, it will be on top of the country (Which is how it supposed to be) but sometimes if I close and run the game again the hover sprite will appear behind the country. (This happens randomly)
Here is an example:
I have set the z value of the ocean game object in the very back to 0, the countries 1, and the hover game object to 2. The game object should always be on top of the countries. Can someone explain why it sometimes go behind the country and sometimes it doesn’t??
The hover game object will always follow the mouse.
Whenever the mouse is not touching a country, the game object will be disabled and when you touch a country it will enable.