¿Cómo puedo escalar el objeto del juego en Unity Engine de acuerdo con diferentes tamaños de pantalla, fuera del lienzo (objetos que no son UI, objeto del juego real)?

programación


 I want to consider the edges/borders of the screens and place the gameObject accordingly with sufficient padding across those edges/borders of screens. Also I have to keep the scale(x & y) equal. 
I have to prevent it from being bigger or smaller and getting out of the view or overlapping with other objects in the game scene. BTW it's a 2D game.

Lo que he probado:

I have tried Camera.main.ScreenToWorldPoint but don't know how to guide it to get what I want. And I don't think it would be sufficient to do that.

Solución 2

Solución 3

Utilice un objeto de juego de UI vacío y deje que el lienzo haga los cálculos, establezca la posición deseada del objeto de juego (no UI) en este objeto de juego vacío de UI mediante un script 🙂

コメント

タイトルとURLをコピーしました