- Home /
Question by
zak666 · Jun 11, 2015 at 08:59 AM ·
scriptingbasics
Raycast and the NEW UI?
Hi this code seems to work fine but when i click my buttons nothing happens. ((the script is assigned to a button that makes other gui objects apear and dissapear. dissapears when i star tthe scene but wont apear when I click.
#pragma strict
// Set GameObject GUI In Witch To Activate.
var StoreFront1 : GameObject;
var StoreFront2 : GameObject;
var StoreFront3 : GameObject;
var StoreFront4 : GameObject;
var RankInformation : GameObject;
var Advertisement : GameObject;
function Start () {
StoreFront1.SetActive(false);
StoreFront2.SetActive(false);
StoreFront3.SetActive(false);
StoreFront4.SetActive(false);
RankInformation.SetActive(false);
Advertisement.SetActive(true);
} // set stroefronts to off untill selected SPacePort.
function Update () {
// uppon button click enable storefront
if (Input.GetMouseButtonDown(0)){
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit: RaycastHit;
if (Physics.Raycast(ray, hit)){
StoreFront1.SetActive(true);
StoreFront2.SetActive(true);
StoreFront3.SetActive(true);
StoreFront4.SetActive(true);
RankInformation.SetActive(false);
RankInformation.SetActive(false);
} // end of raycast
} // End Of Button Input
} // End of Update
Comment
Your answer
