Skip to content

Instantly share code, notes, and snippets.

View sweatyc's full-sized avatar
🏠
Working from home

Sweaty Chair sweatyc

🏠
Working from home
View GitHub Profile
using UnityEngine;
namespace SweatyChair
{
/// <summary>
/// Remove the letterbox when switching windows mode to full screen mode, set the windows to manual screen width (if
/// speicified) when switching full screen mode to windows mode. Standalone only.
/// </summary>
public class ScreenModeSwitcher : PersistentSingleton<ScreenModeSwitcher>
@sweatyc
sweatyc / SettingManager.cs
Last active March 1, 2021 00:16
A master manager that contols in-game settings.
using UnityEngine;
namespace SweatyChair
{
public static class SettingManager
{
/// <summary>
/// Sets the resolution to the specific values, call this on Awake.
@sweatyc
sweatyc / SettingSettings.cs
Last active March 1, 2021 00:12
The setting scipts for Settings in game.
using UnityEngine;
namespace SweatyChair
{
[CreateAssetMenu(fileName = "SettingSettings", menuName = "Sweaty Chair/Setting Settings")]
public class SettingSettings : ScriptableObjectSingleton<SettingSettings>
{
[Tooltip("Manual screen width in Windows, 0 to disable, used for standalone only")]
@sweatyc
sweatyc / ScreenModeSwitcher.cs
Last active August 19, 2019 03:17
Remove the letterbox when switching windows mode to full screen mode, set the windows to manual screen width when switching full screen mode to windows mode. Standalone only.
using UnityEngine;
namespace SweatyChair
{
/// <summary>
/// Remove the letterbox when switching windows mode to full screen mode, set the windows to manual screen width (if
/// speicified) when switching full screen mode to windows mode. Standalone only.
/// </summary>
public class ScreenModeSwitcher : PersistentSingleton<ScreenModeSwitcher>
@sweatyc
sweatyc / unity_screen_window_fullscreen.csv
Last active August 19, 2019 03:20
Unity Screen variables in window mode vs full-screen mode
Window Mode Full-screen Mode
Screen.width Window width Width in current resolution (Window width set before, or width set in Screen.SetResolution)
Screen.height Window height Width in current resolution (Window height set before, or height set in Screen.SetResolution)
Screen.currentResolution.width Same as Screen.width Same as Screen.width
Screen.currentResolution.height Same as Screen.height Same as Screen.height