UnityEngine.GameObject.SendMessage C# (CSharp) Method

SendMessage() public method

public SendMessage ( string methodName ) : void
methodName string
return void
		public void SendMessage(string methodName){}
		public void SendMessage(string methodName, SendMessageOptions options){}

Same methods

GameObject::SendMessage ( string methodName, SendMessageOptions options ) : void
GameObject::SendMessage ( string methodName, System value ) : void
GameObject::SendMessage ( string methodName, System value, SendMessageOptions options ) : void

Usage Example

Esempio n. 1
0
    void Update()
    {
        if (Input.touchCount > 0)
        {
            ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);

                touchPos = ray.origin;
                if (Physics.Raycast(ray, out rHit, 100, enemyMask))
                {
                    reciever = rHit.collider.gameObject;
                    switch (Input.GetTouch(0).phase)
                    {
                        case TouchPhase.Began:
                            reciever.SendMessage("touchStart", SendMessageOptions.DontRequireReceiver);
                            break;
                        case TouchPhase.Ended:
                            reciever.SendMessage("touchUp", SendMessageOptions.DontRequireReceiver);
                            break;
                        case TouchPhase.Canceled:
                            reciever.SendMessage("touchExit", SendMessageOptions.DontRequireReceiver);
                            break;
                    }
                    Debug.Log("raycast hit with enemy");
                    Debug.DrawRay(ray.origin, ray.direction);
                }

        }
    }
All Usage Examples Of UnityEngine.GameObject::SendMessage