Click or drag to resize

TouchLayer Class

Base class for all pointer layers. Used to check if some object is hit by a pointer.
Inheritance Hierarchy
SystemObject
  Object
    Component
      Behaviour
        MonoBehaviour
          TouchScript.LayersTouchLayer
            TouchScript.LayersFullscreenLayer
            TouchScript.LayersStandardLayer

Namespace:  TouchScript.Layers
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public abstract class TouchLayer : MonoBehaviour

The TouchLayer type exposes the following members.

Constructors
  NameDescription
Protected methodTouchLayer
Initializes a new instance of the TouchLayer class
Top
Properties
  NameDescription
Public propertyDelegate
Gets or sets an object implementing ILayerDelegate to be asked for layer specific actions.
Public propertyWorldProjectionNormal
Layers screen to world projection normal.
Top
Methods
  NameDescription
Protected methodaddPointer
Called when a pointer is added.
Protected methodAwake
Unity Awake callback.
Protected methodcancelPointer
Called when a pointer is cancelled.
Protected methodcheckHitFilters
Checks the hit filters.
Protected methodcreateProjectionParams
Creates projection parameters.
Public methodGetProjectionParams
Gets the projection parameters of this layer which might depend on a specific pointer data.
Public methodHit
Checks if a point in screen coordinates hits something in this layer.
Protected methodOnDestroy
Unity OnDestroy callback.
Protected methodpressPointer
Called when a layer is pressed over an object detected by this layer.
Protected methodreleasePointer
Called when a pointer is released.
Protected methodremovePointer
Called when a pointer is removed.
Protected methodsetName
Updates pointer layers's name.
Protected methodupdatePointer
Called when a pointer is moved.
Top
Events
  NameDescription
Public eventPointerBegan
Occurs when layer determines that a pointer has hit something.
Top
Fields
  NameDescription
Protected fieldlayerProjectionParams
The layer projection parameters.
Protected fieldmanager
Layer manager.
Public fieldName
Pointer layer's name.
Top
Remarks

In TouchScript it's a layer's job to determine if a pointer on the screen hits anything in Unity's 3d/2d world.

ILayerManager keeps a sorted list of all layers in Layers which it queries when a new pointer appears. It's a layer's job to return Hit if this pointer hits an object. Layers can even be used to "hit" objects outside of Unity's 3d world, for example Scaleform integration is implemented this way.

Layers can be configured in a scene using TouchManager or from code using ITouchManager API.

If you want to route pointers and manually control which objects they should "pointer" it's better to create a new layer extending TouchLayer.

See Also