- Home /
Looping scenes by pressing "X" button on PS3 controller
Hi there,
I am having some difficulty getting this right. And I dont get why.
I want to users to walk to a door for instance press X on the controller and then the next level must start-up. First off I have a box collider, and attached to it is attached is a tag (When I add this tag to my door, the box-collider is no more a box collider and I can walk strait through it, what am I doing wrong?) and the following script:
#pragma strict
var Level2 : String;
function Update() {
if(Input.GetKey("joystick 14th axis")){
Application.LoadLevel ("Level2");
}
}
function OnTriggerEnter (cubeTrigger : Collider)
{
Debug.Log ("OnTriggerEnter : cubeTrigger.tag = " + cubeTrigger.tag); // shows the tag of the trigger
// if tag is door
if (cubeTrigger.tag == "Room")
{
Application.LoadLevel ("Level2");
}
}
I have also created a C# script and added it in the place of the script above and it doesnt work either:
using UnityEngine;
using System.Collections;
using XInputDotNetPure;
public class looptonewscenecs : MonoBehaviour {
public string Level2;
public void Update()
{
if (!Input.GetButton("X button"))
return;
Application.LoadLevel(Level2);
}
}
In the Input Manager I have assigned the "X" key of my controller to the 14th axis (Joysticks). Both of my scenes have been added to the Scenes in Build. I dont have any errors when I build the game, except I am stuck in the first level no matter what I do.
Any suggestions would be appreciated, I am stuck!
Your answer
Follow this Question
Related Questions
Changing controls from keyboard to touch in the game 0 Answers
Help with player controller 0 Answers
Reduce 'Levels' or Scene File Size 1 Answer
Controller Collision Load Scene 2 Answers
Tags not working 1 Answer