A couple of Gotchas that took me a while to debug!

I was having issues that clicking on the tank would spawn more tanks and it wasn’t getting selected and they were caused by a couple of little mistakes. I’m putting the solution here in case other people did the same thing.

When we did the instantiate code, I just used the transform rather than the transform.position and transform.rotation - its perfectly valid and works fine. But it makes the spawned object a child of the parent - which is often desirable for organisational purposes, but not in this case because every click on a child object registers the click event on the parent.

The second issue took me far too long to diagnose, I’d disabled the circle object itself not just the sprite renderer. I rewatched the video twice looking for issues with how I’d assigned the events and it was as simple as having unchecked the wrong box

1 Like

OMG I had the same problem with having the SelectedHighlight “object” unchecked and it was driving me NUTS! Thanks for this! Fixed by unchecking the SpriteRenderer component, instead of the whole object… Jeez… Imma so dum :smiley:

Privacy & Terms