"Selected" sprite not activating

Hi, I’m having problems with the “Selected” sprite not activating when I press the tank. I’m currently on the “Selecting a unit” lesson. I’ve watched it multiple times to try to find what I’ve done wrong but I can’t find it… I’ve debugged every function and they work fine. I guess there is a problem with the “Unit.cs” script . All help is appreciated!!


Skärmklipp|473x500

Hi Makkan! How does the tank get selected? Is it a raycast? If so, does the tank have a collider?

You can check if the unit is getting selected by serializing the selected units list in the RTSPlayer script. Then we can determine if its being selected or if its an issue with the sprite.

Are any errors thrown in the console?

So I was having this problem too, and I just figured out what I did wrong. The code checks/unchecks the SPRITE RENDERER inside the sprite. I was treating it like it was going to check/uncheck the entire object. So I had the object starting out “off”. Look at your sprite and ensure that the object is “on” or “checked” and that only the SPRITE RENDERER inside the object is starting “off” or “unchecked”

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

Privacy & Terms