ok…this may be a bit confusing…so i will try to dumb it down. I have a model called “document”. i want the gui of the player to show text on-screen when the player wanders over “document”. Can someone please write the script for that…my new game will not make sense without this…thank you all so much.
var iWantToSeeDocument : boolean = false;
var Document : Rect = Rect(Screen.width /2, Screen.height / 2, 300, 600);
var DocName : string = DocumentPage;
function OnTriggerEnter(col : Collider){
if(col.gameObject.tag == "Document")
{
iWantToSeeDocument = true;
}
else
{
iWantToSeeDocument = false;
}
}
function OnGUI(){
if(iWantToSeeDocument == true)
{
Document = GUILayout.Window(0, Document, ShowDocument, ""+DocName);
}
}
function ShowDocument(windowID : int)
{
GUILayout.Label(Rect(0,0,10,10), "Line1");
}
Attach this to the player
Set your DocumentModel a tag called “Document”
And have a collider with isTrigger set to true
To have multiple lines just copy paste the GUILayout.Label onto next lines