Skip to content

Modifying Hits

Valentin Simonov edited this page Jul 30, 2017 · 4 revisions

When a layer looks for scene objects which were hit by new touches you have some control over which objects it can find. For this purpose you can add a script inheriting from HitTest on an object in the scene which in its HitResult IsHit(IPointer pointer, HitData hit) method can decide if this object was really hit or not.

For example, using Untouchable behavior you can make an object ignore touches or discard touches hitting this object.

For this purpose IsHit method can return one of the following values (defined in HitResult enum):

  • Hit if this touch does hit the object,
  • Miss if this touch shouldn't hit the object,
  • Discard if this touch shouldn't hit the object and should be discarded completely.
You can’t perform that action at this time.