Tower Defense Upgrade Buttons wont work / with download

Updated on October 10, 2018 in [A] Tutorials
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
5 on October 9, 2018

hey Guys,

got some problems with my Tower Defense project (Episode 19 and following), my upgrade and sell buttons doesnt work ingame, the onClick event never gets called.

If i put a new button on the overlaycanvas and add the onclick event, i can upgrade my turrets, so i would say something is between the other buttons and my mouse.

Like Brackey, who had problems with the “graphic raycaster” from the topcanvas.

 

I someone want to take a look: https://drive.google.com/open?id=1x2AvTxFrto2wM7_QYdO6b6G7nhdRloJF

Thanks for any help!

  • Liked by
Reply
4 on October 9, 2018

It could be that a panel is blocking your button from being pressed, if the order in the hierachy is not correctly setup. Check that the buttons are always beneath other overlaying UI elements or just set for all UI elements which can not be clicked anyway the “Raycast Target” bool to false in the inspector.

 

on October 9, 2018

try to figure it out over the last hours….. compared my project to the finished one from github, in the hirachy i can find no difference.

Can i log in the console on which element i click? Than i would know which element is in the way.

EDIT: Tried a lot of ways to get unity to show me what iam clicking on, no luck till now.

see here:

https://stackoverflow.com/questions/38539593/how-can-i-get-ui-element-over-which-pointer-is-in-unity3d

Helpful
on October 9, 2018

You can implement this one, to check which one you clicked:

Unity IPointerClickHandler

 

on October 10, 2018

Yeeeeeeeeeees, my MainCamera was in the way apparently…. made a new one and now its working. Nice and  thanks a lot 😀

how do i mark this as solved?

Helpful
on October 10, 2018

Good.

Just don’t write here anymore. A ‘solved’ button does not exist.

Show more replies
  • Liked by
Reply
Cancel