• 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 xKillerKev7x · Jun 19, 2012 at 04:59 PM · weaponswitchpickup

Pick Up Weapons

OK so I am trying to make a pick up script I have a weapon switch script done :D so now I am trying the pickup and I cant seem to get it to work I want it so that when u go over the weapon on the floor a picture of the gun shows this is how I am trying to do it

Weapon Pickup

Weapon Switch

I also would like to know how can I make it so tht the picture shows at the botton in the middle on every single resolution.]

THANKS!

-Kevin

Comment
Add comment · Show 4
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 whydoidoit · Jun 19, 2012 at 05:00 PM 0
Share

Please format your code by indenting it 4 spaces or 1 tab. You can also just paste your code, highlight it and click on the code button.

avatar image xKillerKev7x · Jun 19, 2012 at 05:05 PM 0
Share

I just fixed it using pastebin

avatar image whydoidoit · Jun 19, 2012 at 05:06 PM 0
Share

Both links appear to be the same code!

avatar image xKillerKev7x · Jun 19, 2012 at 06:00 PM 0
Share

LIN$$anonymous$$S FIXED! :D

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by whydoidoit · Jun 19, 2012 at 06:04 PM

So you need to using Screen.height and Screen.width to align your image in your OnGUI.

Something like:

    GUI.DrawTexture(Rect((Screen.width - 100)/2, (Screen.height-30), 100, 20);
Comment
Add comment · Show 6 · 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 xKillerKev7x · Jun 19, 2012 at 06:24 PM 0
Share

So would this work?

GUI.DrawTexture(Rect((Screen.width - 100)/2, (Screen.height - 30),100,20), G36CPic);

avatar image xKillerKev7x · Jun 19, 2012 at 06:31 PM 0
Share

Still wont work :( I will upload a video soon of whats happening I have a box collider around the gun but when I go to the gun I get stuck on the box and the pic wont show

avatar image xKillerKev7x · Jun 19, 2012 at 06:38 PM 0
Share

Ok so it works if I dont have the if(iscollide.gameObject.tag == "PythonPcikup") { }

ERRRR why is it doing this it works without it

avatar image whydoidoit · Jun 19, 2012 at 06:48 PM 0
Share

You have set up your tags properly? Normally you wouldn't tag like that though. You would attach a script to the gameObject and have a variable in that which described what the pickup was and then you could use (iscollide.gameObject.GetComponent(yourScript) as yourScript).type == "Whatever"

The reason being you only have a limited number of tags - you normally tag things like "enemy" or "pickup" rather than an actual type of pickup.

avatar image xKillerKev7x · Jun 19, 2012 at 07:21 PM 0
Share

Not quite understanding you so I would make a whole new script?

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Weapon pick up and switching script 2 Answers

C# Array Issue 2 Answers

Weapon pick up 3 Answers

FindChild not working? (Pick up Object) 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