Event Trigger on Sprite Image not working
Evening all, I have trawled the forums and Google and have not yet found something that works for me, so here goes.
I have 16 sprites in a 3D game that all contain the same image, this is a 2D panel and they are all angled to about 30 degrees. I have added a child to each sprite, a text object that is raised to -0.7 so that it sits directly above the panel.
I want the player to be able to click on the panel and for this to trigger a sequence of events.
So I have added a 3D Box Collider, which I have enlarged so that it is larger than the image and the text, and I have raised it on the Z axis to ensure the front sits above the text object.
I have attached my C# script to the Sprite, added an Event Trigger, and I have then tried Pointer Enter, Pointer Click and Select to call the same procedure and pass in a number ...
public void SelectPlot (int PlotNo)
{
Debug.log("Selected a plot" _ PlotNo);
}
I am not seeing any calls or debug output in the console.
Any suggestions would be much appreciated.
Cheers
Craig
Answer by gocraig · Mar 08, 2016 at 10:03 PM
I was missing a RigidBody and now everything has sprung into action.
Cheers for all the help.
Your answer
![](https://koobas.hobune.stream/wayback/20220612064800im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
creating a 2d peeling system in unity 0 Answers
Help with Instantiation and Sprite changing lag 0 Answers
Is it possible to create a texture that hides a specific texture? 0 Answers
Error messages with 2d character sprite flipping and movement. 1 Answer
cut out face from sprite using camera 0 Answers