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 $$anonymous$$ · Dec 23, 2011 at 10:50 PM · guimaprpgminimapinteractive

Interactive GUI?

Hi, im making an RPG and i have some GUI Textures in it. What im wondering is how to make it so the textures can be clicked and do something. Im making a minimap and have a plus and minus texture but dont know how to make them be clickable or zoom the map in and out.

Please help, thanks

ok, another quick question i have been trying for ages but i cant seem to script a window and button grid to open when the player presses "B" as like an inventory so the grid needs to be in front of the window.

Comment
Add comment · Show 2
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 Apples_mmmmmmmm · Dec 24, 2011 at 02:05 AM 1
Share

You'll want to familiarize yourself more with the GUI scripting.

http://unity3d.com/support/documentation/ScriptReference/GUI.html

For the plus and $$anonymous$$us, you'll want to use the Button function. For the $$anonymous$$i map, you'll probably want to use the ScrollView functions, with a label inside that your map texture will be applied to.

avatar image $$anonymous$$ · Dec 27, 2011 at 10:28 PM 0
Share

thanks for the help!

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by coolthemanp6p · Dec 28, 2011 at 03:29 AM

If you want to do clicking you would create a couple functions:

 function OnMouseDown()
 {
      
 }

This makes it so when you click your left mouse button.

 function OnMouseEnter()
 {
     
 }

This makes it when you hover your mouse over the texture.

 function OnMouseUp()
 {
 
 }

This makes it when you release your left mouse button.

 OnMouseExit()
 {
 
 }

When you your mouse leaves the area of your GUI texture this happens.

With these you can create fully operating buttons.

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
avatar image
0

Answer by ina · Dec 28, 2011 at 01:31 AM

The button syntax took me a while to figure out at first too. The key is that the Rect defines the coordinates of the button in terms of the pixel coordaintes and not the screen coordinates.

var texGraphic:Texture2D; // drag and drop your button graphic here in inspector

function OnGUI(){ if(GUI.Button( Rect(10,10,100,100) , texGraphic)){ Debug.Log("Clicked"); } }

As for making a minimap, you can use raycasthit to determine the screen coordinate hit, and then calculate the location of the minimap clicked on.

Zooming in and out could be as simple as switching the map images to different graphics depending on zoom distance.

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 $$anonymous$$ · Dec 28, 2011 at 05:24 AM 0
Share

Ok cool thanks for the help!

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

6 People are following this question.

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

Related Questions

Map Camera 1 Answer

help with minimap 1 Answer

how make a for loop that makes GUI boxes ? 1 Answer

revealing a Mini map, how to?? 1 Answer

Best way to make a dynamic altimetric minimap? 0 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