This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://frarees.github.io/default-gist-license | |
using UnityEngine; | |
using UnityEditor; | |
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using UnityEngine.Profiling; | |
[InitializeOnLoad] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <summary> | |
/// Resizes a UI element with a RectTransform to respect the safe areas of the current device. | |
/// This is particularly useful on an iPhone X, where we have to avoid the notch and the screen | |
/// corners. | |
/// | |
/// The easiest way to use it is to create a root Canvas object, attach this script to a game object called "SafeAreaContainer" | |
/// that is the child of the root canvas, and then layout the UI elements within the SafeAreaContainer, which | |
/// will adjust size appropriately for the current device./// </summary> |