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
1
Question by TylerTimoJ · Mar 17, 2013 at 01:54 AM · javascriptimagemapsplashgetbuttondown

How to Display Map

I was trying to figure out a script that would allow me to display a map image on the screen when I press "m" and then it would go away. I was trying to get the image to be a map of my terrain with a picture I made of it in Photoshop. I have the picture but how do I make it come up on the screen when I press "m"? I am writing it in Javascript.

Comment
Add comment
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

1 Reply

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

Answer by shigidaMark · Mar 17, 2013 at 03:29 AM

[JavaScript] Attach a script to your camera. Add the variable:

var mapKeyDown : boolean = false;

In your camera's Update function:

 if(Input.GetKeyDown("k")){
     if(mapKeyDown)
         mapKeyDown = false;
     else
         mapKeyDown = true;
 }

Then in your camera's OnGUI function:

 if(mapKeyDown){
     GUI.DrawTexture();
     //see scripting reference for what 
     //attributes to use for this function
 }

https://docs.unity3d.com/Documentation/ScriptReference/GUI.DrawTexture.html

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 Chronos-L · Mar 17, 2013 at 03:54 AM 0
Share

To add on @shigidamark's answer, if you want it to look like a FPS-style map quick-peek, you can modify the map$$anonymous$$eyDown using:

 if(Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.$$anonymous$$)){
    map$$anonymous$$eyDown = true;
 }
 
 if(Input.Get$$anonymous$$eyUp($$anonymous$$eyCode.$$anonymous$$)) {
    map$$anonymous$$eyDown = false;
 }

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

12 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

Related Questions

How to automatically build a map? 2 Answers

Changing Button Image On Click (Javascript) 0 Answers

Changing materials of a plane on keydown. 1 Answer

How to make a 40x40 map out of cubes, using script 1 Answer

How to Manually write a 2 dimensional array in javascript 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