- Home /
Is there any way to just see part of the canvas sometimes?
I'm working on a game where the canvas takes up the whole screen, but sometimes I'd like to focus on one specific part of the canvas. I can't figure out any way to do that. If I add another camera, make that camera smaller than the main camera (so it would be zoomed in on part of the canvas), then change the canvas to render through that camera, the size of the canvas just changes to fill up the whole screen in that camera. Is it even possible to do something like this? I've tried all kinds of search terms about using multiple cameras in one canvas, but I can't find anything.
Answer by saakov · Jan 18, 2019 at 06:01 AM
try worldspace mode of canvas, than it will not change canvas size depend on camera
Oh yeah, that did it. For some reason, I had gotten it into my head that Worldspace was not what I wanted when the whole game was in the UI, but that definitely does what I need it to do a hell of a lot better than Screen Space - Camera.
Answer by surfuay · Jan 18, 2019 at 02:30 AM
are you trying to remove things from the canvas or zoom in on parts of the canvas?
Zoom in on parts of the canvas. It doesn't seem like that's possible, because if I change the size of the camera, the Canvas always just changes to fit it. I tried all the different options under Screen $$anonymous$$atch $$anonymous$$ode, but nothing seems to change it.
ok. so, this may not be the best way but it's what I would do. what ever part of the canvas you want to zoom in on, crop that and save it as a separate image.
so you would have the normal image and then an additional cropped image.
make a public gameObject in the UI script itself as well as another image in the canvas. then set its size and everything else you normally would when its active, set it to inactive after you get where you want.
back in your script, write in where you want it to be set to active.
as long as you're not trying to interact with buttons in that area of the canvas, but are just trying to see a full screen image of that particular area, that should work.