Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Newbie at making Game Menu's as well as Unity 3D interface

Discussion in 'Scripting' started by decoy98, Aug 30, 2011.

  1. decoy98

    decoy98

    Joined:
    Aug 30, 2011
    Posts:
    36
    My indie game development team wants me to first create a button, make sure that I can click on it. Print something to the console to make sure that the button is receiving events.

    Sounds simple but I have no Idea how to do this.:confused:

    Languages I know: Visual Basic, C, C++
     
  2. omgitsalexl

    omgitsalexl

    Joined:
    Jun 20, 2011
    Posts:
    70
    This is very easy to do, and I have posted a link from the documentation and the code sample that it provides. Really though, the documentation and the forum search feature would have been able to provide you what you needed quicker then waiting for a forum reply ;)

    GUI Scripting Guide
    Code (csharp):
    1.  
    2. function OnGUI () {
    3.     if (GUI.Button (Rect (10,10,150,100), "I am a button")) {
    4.         print ("You clicked the button!");
    5.     }
    6. }
    7.  
     
  3. UnknownProfile

    UnknownProfile

    Joined:
    Jan 17, 2009
    Posts:
    2,311
    The unity documentation is your friend. Look up gui button.

    EDIT: omgitsalexl got it first
     
    Last edited: Aug 30, 2011
  4. handsomePATT

    handsomePATT

    Joined:
    Nov 30, 2010
    Posts:
    574
  5. decoy98

    decoy98

    Joined:
    Aug 30, 2011
    Posts:
    36
    I am sorry, someone needs to walk me through this. Where exactly in Unity3D do I find the UnityGUI? Also, how do I get started scripting because whenever I load my screen it takes me to an interface that looks like this:http://tinyurl.com/3kmnqlw
    I just installed unity a week ago, and it seems to take me to a project called AngryBots
     
    Last edited: Aug 30, 2011
  6. UnknownProfile

    UnknownProfile

    Joined:
    Jan 17, 2009
    Posts:
    2,311
    AngryBots is the project that comes standard with Unity 3.4. It's there to give examples of Unity's possibilities. Before trying to make something, take your time to learn the interface. Don't just jump right in headfirst.