- Home /
Answered my own question
Event OnClick on text object?
Is it possible to add a onclick events to a text object prefab? Was only able to make it work with a uninstatiated gameobject. Do I need to add something else? If so, what? Thanks!
Should have mentioned this is a 2d app. If that helps or changes answers.
Answer by hexagonius · Feb 01, 2016 at 08:49 PM
It should be. add the component TriggerEvent. Add an OnClick Event. Add an entry and assign what you need. since Text is a derivation of Ui.Graphic, with which the GraphicRaycaster works (module on Canvas), it should work.
It should work, bit it isn't. I added all these to the prefab and got nothing when instantiated. Is it possible the prefab itself is corrupted??
Strange, i made a sample and Event Trigger works fine after instantiated... $$anonymous$$ake sure you got EventSystem on scene, and text object has Canvas as parent. What kind of action you want to perform on this event?