Z
Z
Zefirot2021-05-07 20:11:58
Unity
Zefirot, 2021-05-07 20:11:58

Can you tell if an image is on the screen?

Is it possible to determine, after displaying an image (prefab) on a canvas or panel, whether it does not climb out of the screen borders or is it completely off the screen?
In terms of the fact that if, when building prefabs on the screen, they suddenly climb out of bounds, then add the ability to zoom until they are visible or move the camera, and if everything is within then without zooming and moving the camera ...
Just as planned, some cards will be the size on the screen and some more (random generation), and now you need to determine whether these prefabs are currently placed on the screen or there are more of them outside, well, adjust the camera adjustment for them ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-05-07
@Zefirot

Can. To do this, there is a WorldToScreenPoint camera method that will give you the coordinates of a point on the screen (even if it is behind the screen). And it will be enough to compare with the screen size

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question