- Home /
How do I make a crosshair?
I'm making a first person game where you pick up and move objects around, and I've made a circular crosshair, put it on a plane, made it a child of the First Person Controller, but whenever I look around in the game, the crosshair goes through walls, despite its closeness to the player, and it won't move up or down. What am I doing wrong here?
Is there a particular reason you need to have the crosshair in World-Space? If not, making it using a UI Image would make things simpler.
It doesn't need to be in the world space, and a UI Image would be much simpler, but I'm not sure how to do that. I'm still a new user.
there is a video on youtube https://www.youtube.com/watch?v=zwuVa-UA-Oo
Answer by felixfors · Jan 08, 2016 at 11:13 PM
Create a Canvas by following thees steps. 1. click on " GameObject" top of the unity window and then UI > Canvas 2. Select the canvas in your Hierachy window and click on " GameObject > image. 3. Import your crosshair texture to unity and change the texture type from " Texture" to "Sprite 2d and UI" 4. change the UI image component to your crosshair texture. 5. select your canvas and change the "Ui Scale mode " from Constant Pixel Size to " Scale with screen size"
That seems like it would work, but my crosshair is off-center and ridiculously big, as well as incredibly faded and barely visible. I'm new to this, so I'm sorry if I'm missing something.
Well if it is off centered you most have done something wrong, because if you follow my steps above it will automaticly be in the center of your screen as defualt and the size is really easy to fix afterwards, just change the width and height of the rect transform component of the image object
Never$$anonymous$$d I was able to figure out how to work the UI canvas. Thank you!
Answer by abandon_games · Apr 20, 2021 at 02:31 PM
For anyone having issues getting your crosshair/reticle image to appear in the middle of the screen with the steps above, try using a Panel (so hierarchy is Canvas > Panel > Image)
here's a good, quick tutorial on creating a dynamic crosshair/reticle - https://www.youtube.com/watch?v=-7DIdKTNjfQ
and this guy created 200 crosshairs that you can download for free - https://kenney.nl/assets/crosshair-pack
Your answer
Follow this Question
Related Questions
FPS Controller Confusion... 0 Answers
Third Person Camera Movement control. 2 Answers
How to change rigs spine rotation? 2 Answers