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 missypooh · Mar 13, 2012 at 02:12 PM · scriptingbasics

Click gameObject and then pop up window

  1. Player click on a gameObject and then pop upwindow.So basically after player click on the gameObject, it will show a list of options. Only one option is correct. I would need to do some checking. For example, button 1 , button 2 and button3, button 1 is the correct option out of the three. How can i do the checking?

  2. Initially the gameObject is disabled (invisible), after the correct answer (button1) is clicked, i want the gameObject to be enabled (visible). GameObject.Find("rad01aa").active = true; // i try using this but it does not appear it when the button is clicked.

http://imageshack.us/photo/my-images/716/door000.png/

Comment
Add comment · Show 3
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 syclamoth · Mar 13, 2012 at 02:31 PM 0
Share

Please split this into multiple questions. It's difficult to answer, otherwise.

avatar image syclamoth · Mar 13, 2012 at 02:32 PM 0
Share

Also, have you heard of the 'if-statement'? That first question of yours is very simple, so I'm a little worried about how useful any advice I can give you would be.

avatar image missypooh · Mar 13, 2012 at 02:50 PM 0
Share

Hi syclamoth, both question 1 and 2 is interlink so i cant split it. Only the third questions are irrelevant. i will do the editing.

Yes, i heard of if-statement. What i am confused it to detect click object then display the list of option. When the correct option is selected, the gameobject will be enabled(visible) to player. http://imageshack.us/photo/my-images/716/door000.png/

From the images, the player have to click on the box(the one with dotted line), then it will display a list of option. If correct option is selected, display the gameobject that are disable in the beginning. So player have to click two boxes and click on the available option as shown in the picture. So would like to ask how can i go about doing it?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DeathHawk · Mar 13, 2012 at 06:08 PM

If your using GUI its really easy if not then get the mouse coordinates on the screen and create a collision box over the buttons you want pressed. When mouse coordinates X and Y are inside of the collision box for button 1 and mouse left button is clicked then button 1 bool = true. After button 1 bool = true if button one is the correct answer the have a bool for correct answer and when that equals true then make the stuff happen that you want to have happen.

Comment
Add comment · Show 5 · 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 missypooh · Mar 14, 2012 at 03:05 AM 0
Share

Hi DeathHawk, look at the picture, I was thinking how about i create an empty button on the box(dotted line). Like that it is easier for me . So basically, the player click the button(the one on the box with dotted line), then it will display the popup window. Regarding the check the correct answer, i still have no clue how to check the answer.

avatar image syclamoth · Mar 14, 2012 at 03:12 AM 0
Share

Come on, it's just an if-statement!

 if(GUILayout.Button("Wrong Answer"))
 {
     answeredCorrectly = false;
 }
 if(GUILayout.Button("Right Answer"))
 {
     answeredCorrectly = true;
 }

I really don't see what is so complicated about this.

avatar image missypooh · Mar 14, 2012 at 02:02 PM 0
Share

Thank you. I will give it a try. How about the question on making the gameobject reappear again? it is using gameObject.enabled = true;

avatar image Bazsee · Mar 14, 2012 at 02:05 PM 0
Share

if you want to use gameObject.enabled, then put a script on the object:

if(answeredCorrectly){ gameObject.enabled = true; }

avatar image missypooh · Mar 14, 2012 at 02:58 PM 0
Share

var r01aa: GameObject;

if(options == true) print("active r01aa"); r01aa.renderer.enabled = true;

i try to do it this way but it doesn't work properly.

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

7 People are following this question.

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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Not every Class in the API is derived from the "Object"-Class, so what are they? 2 Answers

Script to teleport player (Beginner here) 0 Answers

How to learn scripting without Unity 3 Answers

Difference between while loop and dowhileloop? 1 Answer


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