Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Fred_Vicentin · May 13, 2013 at 05:13 PM · menuguitextureitween

[Solved]Click on selectec GUI with tag

Hey guys, I'm doing a Menu, and I want to select what's GUITexture I'm clicking.

I have 3 itens and them has a global iTween animation, this is the code:

   public Texture2D normalTex;
   public Texture2D hoverTex;
   public GameObject Menu;
 
 
 public void OnMouseDown()
     {
         
         iTween.MoveTo(Menu, iTween.Hash("y", 0.1, "easeType", "easeOutQuad", "speed", 1));
         
         //There is where I want to know whats the GUI I'm clicking
         if (GameObject.Find("Start") //Like hit.gameObject.tag == "Start")
         {
             Debug.Log("Start");
         }
         if (GameObject.Find("Credits"))
         {
             Debug.Log("Credits");
         }
         if (GameObject.Find("Exit"))
         {
             Debug.Log("Exit");
         }
        
     }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fred_Vicentin · May 13, 2013 at 05:30 PM 0
Share

Solved, my wrong, I changed to if (gameObject.tag == "Start"), now it recognize which button I've clicked

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by dorafa · May 13, 2013 at 06:40 PM

Hola, estoy iniciando en Unity 3D y quiero trabajar las GUI para mostrar unas opciones de menú sobre algunas escenas, he leído mucha información en Internet y tengo este código pero no tengo claro como hacerlo, sobre cual componente programar, alguien podría explicarme como hacerlo paso a paso?:

función OnGUI () { / / Hacer un cuadro de fondo GUI.Box (Rect (10,10,100,90), "Menú Loader");

 / / Hacer que el primer botón. Si se pulsa, Application.Loadlevel (1) se ejecutará
 if (GUI.Button (Rect (20,40,80,20), "Nivel 1")) {
     Application.LoadLevel (1);
 }

 / / Hacer que el segundo botón.
 if (GUI.Button (Rect (20,70,80,20), "Nivel 2")) {
     Application.LoadLevel (2);
 }

}

Ya lo he hecho con un GUI TEXTURE y el siguiente codigo:

function OnMouseDown ( ){ Application.LoadLevel("construccion"); }

Así si me ha funcionado pero me parece que no se ve muy bien presentado, no se cuando se usa la función ONMouseDown y cuando se usa la funcion OnGUI, alguien que me ayude por favor, si es posible paso a paso ya que apenas estoy empezando a utilizar UNITY 3D. Gracias de antemano

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fred_Vicentin · May 13, 2013 at 07:07 PM 0
Share

This forum is for English only

avatar image
0

Answer by dorafa · May 13, 2013 at 06:40 PM

otra cosa, he intentado creando un NewGUISkin pero no sé como programarlo, aparte he creado un JS con el primer codigo mencionado en el comentario anterior, pero no me deja correr el programa me arroja un error BCE0044: unexpected char: 0xF3 que no se a que se refiere y no he encontrado en internet, creo que lo estoy programando mal y no se como enlazar el JS con el NewGUskin... por favor alguien que pueda explicarmelo a manera de tutorial.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GUI, character selection & general menu 1 Answer

GUItexture Borders & Pixel Inset concept 0 Answers

Why do I have to click GUI Menu twice to start in Web player? 0 Answers

Scale a GUITexture from its center 1 Answer

How to make a GUI Texture clickable when it's a gameobject animted through iTween? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges