[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
Saya mengajukan pertanyaan Anda ke Google Penelusuran: Bagaimana cara menskalakan objek game di mesin unity secara otomatis sesuai dengan ukuran layar, di luar kanvas?[^]
Itu memberi saya video YouTube ini: CARA MENINGKATKAN UI UNTUK MENYESUAIKAN RESOLUSI LAYAR APA PUN DI GAMEMU – TUTORIAL MINI UNITY – YouTube[^]
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]
コメント