Here’s exactly what is happening : I have a Canvas which contains my Game UI (Pause Button, Scores, etc.) and also contains my “Buttons” Panel. This Buttons Panel has 64 buttons, and each button has a list of coordinates. For each level, they go to a different position by looking at their own list of coordinates and going to the corresponding x and y value. These coordinates are WORLD positions, NOT SCREEN positions.
Because they’re world positions, the Canvas must be set to World Space for the positions to be read correctly so that they actually go to the right place. If it’s set to Screen Space - Overlay, it goes to a different place (because the 0,0 for Screen Space is different from the 0,0 for World Space).
However, my Game UI needs Screen Space so that it can adjust its position on the Canvas according to the phone’s screen-size. If it uses World Space, it won’t be able to adjust it’s position at all.
So, 2 things under one canvas need Screen Space and World Space. Which is impossible, since it can only be one.
Now, one thing I was thinking of was making 2 canvases. One for Screen Space (for the UI and one for World Space (for the Button panel). But this is the problem: The Screen Space canvas is ALWAYS one top and blocks the World Space canvas from view, because the Screen Space canvas is, well, the screen! So because of THIS, the button panel would never even be seen.
So, there is no easy solution. However, I thought: Hmmmm… what if I made it so that the Buttons could take the corresponding x and y values from the list, and then convert them into Screen Space coordinates, so that it could use a Screen Space. Then, this would mean that there would only one canvas needed: a Screen Space canvas.
However, to do this, I would need to convert the current x and y World Space coordinates that I have into Screen Space coordinates. So what commands would I need to do this?
P.S: I can’t actually CHANGE the list of coordinates I have into Screen Space because I put the coordinates in manually into a public variable. I get those coordinates from the X-Position and Y-Position values of the “Rect Transform” component. And the positions always show up as World Space coordinates for me (unless there’s an option to change that). Do you know of any way to change it?
Thanks! Hope that made sense - just try to imagine it in your head!