How to Use Co-routine For Taking Touch Event in Unity(Mouse Event And Keyboard KeyEvent), Also Explained How to call coroutine from other script
1. Co-routine for Taking Touch Event Step 1: Add Box-Collider to Your GameObject On which you want take touch event. Write Following in followpath.CS Step 2 : Following is Co-Routine for taking touch event. ------------------------------------------------------------------------------ // This method accepts gameobject name parameter, // Then in this method we get name of object on which user tap. // If both equals then we end while loop.In this way we can take touch event and mouse click event. public IEnumerator WaitForTouch_Player(string player1) { bool found = false; Touch touch; Ray screenRay; RaycastHit hit; string objname; while (Input.touchCount == 0 || found == false) { if (Input.touchCount > 0) { touch = Input.GetTouch (0); if (touch.phase == TouchPhase.Began) { s...