Can we see the full script? You probably are doing something like calling GUI.BeginSomething(); without calling GUI.EndSomething();, or the script hits an exception and stops before reaching the EndSomething.
One thing that looks like it could cause an exception is that you are using GetComponent() on a component that I assume (from looking at your start function) is not enabled. GetComponent() does not find unenabled components. Therefore you might be doing:
if (GUI.Button (Rect (0,30,200,30), button_Text1)) {
button_Text1 = "No money no honey baby!";
b_Play = false;
null.enabled = true;
null.enabled = true;
}
You fix this by cashing a reference to each component in a private variable in Start, then setting enabled on those variables instead of with GetComponent().
var button_Text1 : String = "Play Game";
var button_Text2 : String = "Get Plug-in";
var button_Text3 : String = "CREDITS";
var b_Play = true;
function Awake(){
GetComponent(SuperMarioCamera).enabled = false;
GetComponent(Controller).enabled = false;
}
function OnGUI () {
if(b_Play){
// Make a group on the center of the screen
GUI.BeginGroup (Rect (Screen.width / 2 - 100, Screen.height / 2 - 120, 300, 120));
// All rectangles are now adjusted to the group. (0,0) is the topleft corner of the group.
// We'll make a box so you can see where the group is on-screen.
GUI.Box (Rect (0,0,200,200), "PROJECT");
if (GUI.Button (Rect (0,30,200,30), button_Text1)) {
button_Text1 = "No money no honey baby!";
b_Play = false;
GetComponent(SuperMarioCamera).enabled = true;
GetComponent(Controller).enabled = true;
}
if (GUI.Button (Rect (0,60,200,30), button_Text2)) {
button_Text2 = "UNITY3D.com";
}
if (GUI.Button (Rect (0,90,200,30), button_Text3)) {
button_Text3 = "AQUIRIS";
}
// End the group we started above. This is very important to remember!
GUI.EndGroup ();
}
}
this was suposed to “turn On” the SuperMarioCamera and the Controller Scripts… If I change for null.enabled = true; as you said, how could I point those enables to the par of scripts?
I didn’t say to use null.enabled = true;, I said that right now you are using that, because GetComponent(SuperMarioCamera) returns null if SuperMarioCamera is not enabled. And I think it isn’t enabled.
Here is an example of what I was suggesting:
private var coolioComponent : CoolioComponent;
function Start ()
{
coolioComponent = GetComponent(CoolioComponent);
coolioComponent.enabled = false;
}
function Update ()
{
// enable the component if the a key is held down
coolioComponent.enabled = Input.GetKey("a");
}