1

I am using Myo so my inputs are not the same as keypress and mouse.

I am trying to access items in the scroll UI Panel. Here is a snapshot of my Unity3D hierarchy.

https://i.stack.imgur.com/jk6yq.jpg

As you can see, I have

-StoreMenu
 -ScrollPanel
  -ScrollRect
   -ShopItems (list of items)

How can I possibly scroll and highlight the list of item. And on certain input gesture, get it selected ?

I'ved only managed this far:

                scrollpanel = GameObject.Find("ScrollPanel");
                scrollRect = scrollpanel.GetComponent<ScrollRect>();
                scrollRect.GetComponent<ScrollRect>();
                scrollRect.verticalNormalizedPosition = 0.5f;

I can get the scrollrect, move to certain position in the scroll but items are not highlighted.

Thanks in advance.

Axil
  • 3,606
  • 10
  • 62
  • 136

1 Answers1

2

TRY THIS : http://docs.unity3d.com/462/Documentation/ScriptReference/EventSystems.EventSystem.SetSelectedGameObject.html

This can be used to Set the object as selected

Sreejit Pillai
  • 125
  • 4
  • 14
  • Thank you very much for your answer, but not sure yet how to get to there. I think first is how can i get the list of items in the scroll ? what should i do ? Thanks again – Axil Sep 18 '15 at 10:17
  • Thanks Sreejit! Almost there, I can use now SetSelectedGameObject like this now http://pastebin.com/ZrZTpPkb. Now how to I emulate like the mouseclick on that selected gameobject ? is there like I can do an eventClickonGameObject something like that ? Thanks again... almost there – Axil Sep 18 '15 at 10:47
  • Go through this: http://answers.unity3d.com/questions/820599/simulate-button-presses-through-code-unity-46-gui.html If you are still not able to get any solution then just reduce the alpha in color of Image/Sprite Renderer of that particluar object and start a coroutine that will slowly change the value of the alpha to 1. You can also reduce the scale by 20% and then increase the scale to original Scale in that same coroutine. – Sreejit Pillai Sep 18 '15 at 10:55