- Home /
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
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
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.
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);
So would this work?
GUI.DrawTexture(Rect((Screen.width - 100)/2, (Screen.height - 30),100,20), G36CPic);
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
Ok so it works if I dont have the if(iscollide.gameObject.tag == "PythonPcikup") { }
ERRRR why is it doing this it works without it
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.
Not quite understanding you so I would make a whole new script?
Your answer
Follow this Question
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
picking up weapons script? 3 Answers