- Home /
Script working for standard FPS controller not mobile FPS controller
function OnControllerColliderHit (hit : ControllerColliderHit) {
if(hit.collider.gameObject == GameObject.Find("Cube")){
Application.LoadLevel(1);
This is a simple script i attached to my First Person Controller prefab, when i attached the same script to the First Person Controller prefab from the mobile standard assets it ceases to work.
Is there any reason for this? If im scripting wrong for Ios can someone direct me to a source that can help me please?
Thanks in advance :)
Answer by Jan Helleman · Jul 11, 2011 at 10:40 PM
Is it crashing? I had this problem once, turned out my next level had unsupported game objects (for example, cloth physics) in it. Even if it's "disabled", it fails on Application.LoadLevel, even though it does work when you set that level as the first active level.
Hey Jan,
it's not crashing, it simply doesn't work. I'll hit the collider but nothing happens. The 2nd level is a duplicate of the first, just with a few things moved so that i can recognise the change.
I place the script on the parent on both fps controllers, just the mobile standard assets one just doesn't work.
Thanks for the help :)
have you tested print("") ins$$anonymous$$d of loadLevel to test if it even gets to that point? Are you sure there is an object called "Cube"? Have you tried if loadLevel() works within another function? What were your debugging steps?
Figured it out thanks :),
The problem was on the normal fps controls i added my collisions script to the parent (which worked fine), but for the mobile assets you have to attach it to the 1st child as the other control scrips are there.
Thanks for the help, it's really appreciated :)
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Can you detect the movement of the left and right How can it? 1 Answer
Hover Car Controller? 0 Answers
Turning GUI off not working for iOS 1 Answer
Sprite Sheet Issue 0 Answers