Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

little colliders ovveride big collider

Discussion in 'Scripting' started by spbsmile, Jun 20, 2014.

  1. spbsmile

    spbsmile

    Joined:
    Mar 11, 2013
    Posts:
    7
    i have gameobject "Sprite" .attach Boxcollider
    "Sprite" have child - gameobject "button".(uisprite, uibutton) attach boxcollider too
    "button" inside "Sprite"

    i use ngui event - OnHover
    my problem: when mouse onhover sprite - sprite position animate
    i use script TweenPosion and all ok
    but... a have problem
    little colliders(buttons) ovveride big collider(sprite) and i when mouse move on little collider . ( little collider inside big collider )
    valie field isOver assign - false . and tween position come back
    how solve this problem ?
     
  2. jister

    jister

    Joined:
    Oct 9, 2009
    Posts:
    1,749
    never used ngui... but depending on what you want, can't you filter out what you're hovering above with tags or layers?
    i.e. use the ignore raycast layer on the buttons?
     
  3. zaxvax

    zaxvax

    Joined:
    Jun 9, 2012
    Posts:
    220
    Yes, need to make up ngui layers. If I recall it right there was a nice tutorial about layers and basic structure of ngui interfaces somewhere on it's author's site.
     
  4. Ereous

    Ereous

    Joined:
    Aug 29, 2012
    Posts:
    163
    Is the layer order correct? I think a Screen shot would help understand more of your problem.

    If you had an two buttons nested [ button [ button ] ] The nested button should be a layer priority over the parent.

    Like I said further information would help.
     
  5. spbsmile

    spbsmile

    Joined:
    Mar 11, 2013
    Posts:
    7
    oh, wow
    three responses
    thank you
    sprite - yellow . button - black
    sprite animattion position, when mouse onhover on boxcollider of sprite
    but when mouse on black button . boxxollider of button ovveride boxcollider sprite and animation sprite come back because bool value onhover assign false

    Screen shot :
     
  6. jister

    jister

    Joined:
    Oct 9, 2009
    Posts:
    1,749
    As said before: Use layers...
    put your button in a different layer and let your onHover for the sprite ignore that layer.