解決缺口/切口屏幕手機(jī)UI布局問題的一組組件和工具
GitHub 上的工程多如繁星,有些好的倉庫欣鳖,但凡不經(jīng)意間錯(cuò)過了就很難找回察皇,故稍作采擷,希望能幫助到有心人泽台。
簡介:
A set of components and tools to solve notched/cutout phones layout problems for Unity. Whether you like it or not, the time has come for us designers to design in context of a notch and embrace it instead of hiding it. This tool also enables design-time preview which help you iterate your design without building the game. Minimum Unity version 2019.1.
- 一套用來解決 Unity 中缺口/切口手機(jī)UI布局問題的組件和工具什荣。 不管你喜歡還是不喜歡,帶缺口的全面屏就在那里师痕,于是我為它設(shè)計(jì)了這個(gè)適配工具溃睹。 該工具還允許設(shè)計(jì)時(shí)預(yù)覽,都不需要打包調(diào)試吼胰坟。
功能:
Components : Attach to your game objects to make them notch-aware.
組件式 - 掛載插件提供的組件即可實(shí)現(xiàn)異形屏的缺口規(guī)避
-
SafeAreaPadding:
RectTransform
layout component for uGUI based on the value returned byScreen.safeArea
.
- 基于 Screen.safeArea 返回值的UGUI RectTransform 布局組件 -
Adaptation Components: Adapts any game object with Animation Playables API and
Animator
component.
- 適配任意的掛載 / 使用了Animation Playables API 和 Animator 組件的游戲?qū)ο?-
AspectRatioAdaptation: Dynamically changes anything based on the ratio of the screen.
- 根據(jù)屏幕的比例動(dòng)態(tài)更改任何內(nèi)容 -
SafeAreaAdaptation: Dynamically changes anything based on the safe area.
- 根據(jù)安全區(qū)域(safe area)動(dòng)態(tài)更改任何內(nèi)容
-
AspectRatioAdaptation: Dynamically changes anything based on the ratio of the screen.
Simulation : Iterate your design in context of notch right from Unity editor.
可仿真 - 讓你無需真的打包安裝到手機(jī)就能以所見即所得的仿真方式調(diào)試與設(shè)計(jì)與迭代
- 目前支持模擬仿真的設(shè)備如下:
iPhone X
iPad Pro
(Contributed by 06Games)Huawei Mate 20 Pro
OnePlus 6T
Samsung Galaxy S10
Samsung Galaxy S10+
使用:
- 只需在工程 Package/ manifest.json 插入一行
"com.e7.notch-solution": "git://github.com/5argon/NotchSolution.git"
就能通過 Unity PackageManager 安裝。當(dāng)然直接直接下載使用啦笔横。 -
Android 需勾選位于 Resolution and Presentation 下的 “Render outside safe area” 竞滓。
演示:
鏈接:
5argon/NotchSolution
su10/AutoScreen: A smart solution of safe area for Unity. - 類似倉庫
結(jié)語:
Unity 2019.2 開始本文前面提到的 safe area 還能返回 一個(gè)環(huán)繞缺口的矩形面積,這個(gè)倉庫正在研究使用這個(gè)特性吹缔,敬請關(guān)注商佑。
轉(zhuǎn)載請注明出處,謝謝~
本文集持續(xù)更新ing厢塘,喜歡記得點(diǎn)贊關(guān)注哦茶没!