Quantcast
Channel: Questions in topic: "renderer.enabled"
Viewing all articles
Browse latest Browse all 99

Is it possible to start a game and get GUI-button act as like its already pressed? (Javascript)

$
0
0
Hello, I have a problem because I've created two GUI-buttons that hides/disables and unhides/enables gameObjects renderer. And I need to second one act like its already pressed once when the game starts or something like that. The script I have: var S1 : GameObject; var S2 : GameObject; var S3 : GameObject; var S4 : GameObject; var K1 : GameObject; var K2 : GameObject; var K3 : GameObject; var K4 : GameObject; function OnGUI () { if(GUI.Button(Rect(220, 140, 80, 20),"HOID2")) { S1.GetComponent.().enabled = false; S2.GetComponent.().enabled = false; S3.GetComponent.().enabled = false; S4.GetComponent.().enabled = false; K1.GetComponent.().enabled = true; K2.GetComponent.().enabled = true; K3.GetComponent.().enabled = true; K4.GetComponent.().enabled = true; } if(GUI.Button(Rect(220, 100, 80, 20),"HOID")) { S1.GetComponent.().enabled = true; S2.GetComponent.().enabled = true; S3.GetComponent.().enabled = true; S4.GetComponent.().enabled = true; K1.GetComponent.().enabled = false; K2.GetComponent.().enabled = false; K3.GetComponent.().enabled = false; K4.GetComponent.().enabled = false; } } So is it possible to create something like that the "HOID2"-button already does the thing even it's never been pressed or is this a lost cause? Hope you understand what I mean, thanks in advance.

Viewing all articles
Browse latest Browse all 99

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>