2D Toolkit Forum

2D Toolkit => Support => Topic started by: Arnold on December 22, 2013, 03:35:26 pm

Title: UIItem in Scrollable Area does not fire Clicks
Post by: Arnold on December 22, 2013, 03:35:26 pm
Hey,

I have a Prefab with which is a UIItem (target is another gameobj, which should fire a method with "on release" ) which resides inside a Scrollable Area. If i drag & drop the Prefab in the scene view manually and try to click it, everything works as it should. When i instantiate the same prefab via load from the resources it does not get recognized. I have checked if the Prefab Clone has different values than the one i drag & droped, but they are the same.

I'm completely lost on this on.

*Update:

Problem seems to be another one i attached a screenshot. If the Sprite is below the Scroll area it don't get any clicks, if it's not below it works...
Title: Re: Per script loaded UIItem in Scrollable Area does not fire Clicks
Post by: unikronsoftware on December 22, 2013, 04:34:06 pm
If its a prefab then it won't remember in scene targets. How are you setting up the targets, and #2 where are the transform positions when instantiating? It could be behind a collider which is stopping it from receiving clicks. It also might not have the isChildOfAnotherUIItem ticked? If you change the parent, you should also call UpdateParent after reparenting.
Title: Re: UIItem in Scrollable Area does not fire Clicks
Post by: Arnold on December 22, 2013, 04:44:32 pm
Its definitely the scroll area collider who is stopping it, but how should i set it up. This is exactly like in the UI Demo, but i'm using a sprite instead of a UI Button.

*Update:

Ok wow i fixed it. My Sprite was on the wrong z. The scrollable area is on 0 my sprite on 1. That was wrong, after changing it to 0 it worked. An Afternoon wasted!

Thanks for hint ;).