Author Topic: Ignore deselect if clicked on specific object (OnSelect)  (Read 3283 times)

UNSH

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Ignore deselect if clicked on specific object (OnSelect)
« on: January 22, 2015, 06:53:13 AM »
Hi,

I have a scene with a 2DUI and the UICamera script attached to my main camera to handle the interaction in my game. I want to use OnSelect to select objects in 3D space and manipulate them with sliders. The problem is that when I use select an object in the space and then click on the slider, the object gets deselected.

What's the best way to go about fixing this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Ignore deselect if clicked on specific object (OnSelect)
« Reply #1 on: January 22, 2015, 12:24:18 PM »
NGUI's selection can only belong to one object at a time. If you want to make it possible to have some object stay selected, then you shouldn't rely on OnSelect and create your own flag instead.

You can do it by subscribing to UICamera.onSelect event in some generic manager class that will keep track of the current virtual selection based on what was selected last.