Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sweaty Chair sweatyc

🏠
Working from home
View GitHub Profile
View ScreenModeSwitcher.cs
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 Mar 1, 2021
A master manager that contols in-game settings.
View SettingManager.cs
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 Mar 1, 2021
The setting scipts for Settings in game.
View SettingSettings.cs
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 Aug 19, 2019
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.
View ScreenModeSwitcher.cs
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 Aug 19, 2019
Unity Screen variables in window mode vs full-screen mode
View unity_screen_window_fullscreen.csv
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