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 matt.weeden · Dec 07, 2011 at 09:55 AM · guitower-defense

help with tower defense

ok so heres the problem I have script that lets you buy towers and place them on the ground it has an amount of money left and the tower cost in it, however I need those to show up on the screen as gui and I am stuck! also there is a message that if the tower price in greater than the amount of money left it will show up in the debug console how can I get it to show up as a message on screen aswell.

thanks in advance

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 Kacer · Dec 07, 2011 at 10:10 AM 0
Share

Have you had any experience with the unity's GUI?

just so i know what level my answer should be at :P

avatar image matt.weeden · Dec 08, 2011 at 10:52 PM 0
Share

no I have had basicly no experience at it.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by matt.weeden · Dec 09, 2011 at 01:53 AM

var TowerPrefab : Transform;

var totalMoney = 3000;

var towerPrice = 900;

 function Update () {

     if(Input.GetButtonDown("Fire1"))

     {

         var ray = Camera.main.ScreenPointToRay (Input.mousePosition); 

         var hit : RaycastHit; 

         if(Physics.Raycast(ray, hit) && towerPrice <= totalMoney)

             Instantiate(TowerPrefab, hit.point, Quaternion.identity); 

         if(Physics.Raycast(ray, hit) && towerPrice <= totalMoney)

             totalMoney = totalMoney - towerPrice;

         if(towerPrice >= totalMoney)Debug.Log("insufficient funds");

     }

}

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 bula · Dec 08, 2011 at 10:58 PM

Lol thats s easy (if i undestanded) If you want something like a menu for buying towers is easy....Make the menu in photoshop Fireworks whatever and add a gui texture in the game Make the scipt so that if you press it is actually hapening something.... And then there is your Buy Towers Menu.

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 bula · Dec 08, 2011 at 10:59 PM 0
Share

if you want something like the script you will can find it at Unity stundents Gui thingy Ok Hope it Helps :)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Setting Scroll View Width GUILayout 1 Answer

gui help for ammo display 1 Answer

Pause Menu 5 Answers

Floating Enemy Health Bars? 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