i got a
gamecamera
pausecamera
when level loads game camera its active
when i press optionguiTexture it disables game camera and enables pause camera.
problem is on unity it works great cuz i used a on mouse down, but i also have the ray hit for mobile, and when i click anywhere on the screen on game camera it switches pause camera and then i cant click anything on pause camera, altho it works great on unity here my come.
MY GUITEXTURE SCRIPT
#pragma strict
private var hit : RaycastHit;
//CAMERAS//
var gamecamera : Camera;
var pausecamera : Camera;
//GUITEXTURES//
public var optionsTexture : GUITexture;
function Start () {
gamecamera.camera.active = true;
pausecamera.camera.active = false;
}
function Update()
{ions
var touches = Input.touches;
//detect which mobile buttons are pressed
for (var touch in touches)
{
if(touch.phase != TouchPhase.Canceled && touch.phase != TouchPhase.Ended)
{
if(optionsTexture.HitTest (touch.position)) //if touch position is inside options texture
gamecamera.camera.active = false;
pausecamera.camera.active = true;
}
}
if(Input.touchCount == 0)
{
}
else
{
//----------------------------------
}
}
//function OnMouseDown () {
// gamecamera.camera.active = false;
// pausecamera.camera.active = true;
// }
MY PAUSE CAMERA SCRIPT
#pragma strict
private var ray : Ray;
private var hit : RaycastHit;
function Start () {
}
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, hit))
audio.Play();
{
//////////INTRO/////
if(hit.transform.name == "pauserestartbutton")
{
Application.LoadLevel (Application.loadedLevel);
}
if(hit.transform.name == "pausemainmenubutton")
{
Application.LoadLevel("main");
}
}
}
}
i cant figure out what im doing wrong, i been at itfor a couples days, someone enlight me please
PS : all references are are set on inspector