- Home /
 
Raycast Hit App Crashes on touch
Hey everybody,
i use a raycasthit to check if any of my mesh collider was hit. here is the code:
 for(int i = 0; i < Input.touchCount; i++)
             {
                 currTouch = i;
                 if(Input.GetTouch(i).phase == TouchPhase.Began)
                 {
                     ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);
                     if(Physics.Raycast(ray, out rayHitInfo))
                     {
                         rayHitInfo.transform.gameObject.SendMessage("OnTouchBegan3D");
                     }
                 }
             }
 
               this works fine in unity 4.1.1 but when I use it in 3.5.4 (i am stuck to that due to a plugin licensing issue) and build it in xcode the app crashes when i touch anywhere on the screen.

Any idea how this could happen?
thanks in advance for your answers.
EXC_BAD_ACCESS is usually caused by a NullReferenceException.
In the Unity preview everything works fine, of course there i just use On$$anonymous$$ouseDown but after building it in xcode it even crashes when i hit a field without any collider ...
Your answer
 
             Follow this Question
Related Questions
Unity crashes on GameObject = hit.collider.gameObject; 1 Answer
Interact with Overlapping UI Simultaneously 0 Answers
Debugging "SIGSEGV" error? 2 Answers
select and drag an object with touch 1 Answer