Hello,
I’m working on a 3D FPS game. I’m just starting getting familiar with scripting and Unity engine.
For my first scene, i’m trying to make appear an Image when you press an input button ( Xbox 360 controller), who works only when you on sphere collider zone. Something like pressing the 17, 18 or 19 Mapped Button Number corresponding to ( B ), ( X ), ( Y ) on my OS X El capitan driver.
I want also to make 3 levels and wish this function stay valable when i’ll come back from other levels. Bellow this, there’s a screenshot of my sphere collider, and the image that i’m tryng to make appear.
I’ve tried this script to make appear the Image when the player trigger the collider without any input button, but it doesn’t work.
#pragma strict
private var guiShow : boolean = false;
var riddle : Texture;
function OnTriggerStay (Col : Collider)
{
if (Col.tag == "Player")
{
guiShow = true;
}
}
function OnTriggerExit (Col : Collider)
{
if(Col.tag == "Player")
{
guiShow = false;
}
}
function onGUI ()
{
if(guiShow == true)
{
GUI.DrawTexture (Rect (Screen.width / 4.5, Screen.height/ 4, 1024, 512), riddle);
}
}
I’m not yet familiar with scripting and the EventSytem and Standalone Input Module.
I guess it’s not complicated and i assume that the question is quite often asked, but somebody help ?