Trying to make a cookie clicker style menu for buying upgrades as an example

i have been trying to work out the best way to set this up. I have 3 things that i would like to be able to click on. then when you click on each one id like a new window, or a new pop up to come up and have a list of options that you can select.

right now i have tried this code, but it is saying there are errors, and i am not quiet sure where i am missing the errors at.

using UnityEngine;
using System.Collections;

public class regionmenutest : MonoBehaviour
{

    var plain : GameObject ;
    var spawn_possition;
   
   
    function Start ()
    {
        plain.GameObject.SetActive = false;
        spawn_possition = Vector3 (0, 0, 0);
    }
   
    function Update ()
    {
       
    }
   
    function OnMouseDown ()
    {
        plain.GameObject.SetActicve = true;
    }

}

in my head i was thinking if i assigned the plain that was turned up to the game object in this code i could make it appear when something is clicked. not sure if i did this correctly though, or if there is a better way to do this. any thoughts would be awesome, thanks!

just looking for what the best way to set something like this up in unity would be. another thought was possibly having each one open a new scene and just building the buttons and upgrades etc. into each new scene and making a back button that sent the user back to my main scene of the game.

Most likely the typo of “SetActive” in OnMouseDown.

oh jeeze… yeah good catch Ryjah! thanks, feel pretty lame missing some of these easy fixes, but thats all part of learning, thanks for the help!

hmm, i fixed that and i am still getting a couple errors…

here is the code now

using UnityEngine;
using System.Collections;

public class regionmenutest : MonoBehaviour
{

    var plain : GameObject;
    var spawn_possition;
   
   
    function Start ()
    {
        plain.GameObject.SetActive = false;
        spawn_possition = Vector3 (0, 0, 0);
    }
   
    function Update ()
    {
       
    }
   
    function OnMouseDown ()
    {
        plain.GameObject.SetActive = true;
    }

}

line 7 says it has 2 errors on it.

You have to declare what the type is, there isn’t a way for the compiler to infer the type in a straight declaration. Plus, you’re mixing unityscript with csharp syntax.

instead of var, use the type like this:

public GameObject plain;
public Vector3 spawn_possition; // misspelled

plus the following lines need to be modified:

spawn_possition = new Vector3(0, 0, 0);

and

plain.GameObject.SetActive(true);

Plus, this is pretty unsafe. What if someone didn’t assign the plain object? You should check:

if (plain != null) plain.GameObject.SetActive(true);

Before you get much farther, I recommend learning a bit of C#:

http://www.microsoftvirtualacademy.com/training-courses/c-fundamentals-for-absolute-beginners

thanks, sorry i was mixing those up.

yeah, i went through some classes for them, i am going to try to learn some more now. i did a basics course through that java and some others. thought i had it straight, but i guess not. thanks for the help. ill concentrate on just c # right now until i feel like i have that down solid.