Bagaimana cara menskalakan objek game di mesin unity sesuai dengan ukuran layar yang berbeda, di luar kanvas (objek non UI – objek game sebenarnya)?

pemrograman

[ad_1]

 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.

Apa yang saya coba:

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.

Solusi 2

Solusi 3

Gunakan gameobject UI yang kosong dan biarkan kanvas menghitungnya, atur posisi gameobject (non UI) yang diinginkan ke gameobject kosong UI ini melalui skrip 🙂

[ad_2]

コメント

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