Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Touch not registering

$
0
0
I am getting this error message each time I touch an object on an ios platform with the remote app. NullReferenceException: Object reference not set to an instance of an object test-unity-5.Update () (at Assets/my-scripts/test-unity-5.js:14) I don't know how to solve it, and don't even know why it is occurring. ( I have a general idea, but...) My code is: #pragma strict private var JumpH = 8; // Jump Hieght 8 units private var IsFalling = false; // Is not falling start var particle : GameObject; function Update () { for (var touch : Touch in Input.touches) { if (touch.phase == TouchPhase.Began) { var ray = Camera.main.ScreenPointToRay (touch.position); if (Physics.Raycast (ray)) { //ad effects here rigidbody.velocity.y = JumpH; IsFalling = true; } } } } I am touching a button I imported that is stacked in the camera, my player's view. I am new to unity, so please don't be spiteful. Any help is appreciated!

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>