This file contains hidden or 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 System; | |
using UnityEngine.Profiling; | |
// See UnityEngine.TestTools.Constraints.AllocatingGCMemoryConstraint | |
// and https://maingauche.games/devlog/20230504-counting-allocations-in-unity/ | |
public class AllocCounter { | |
UnityEngine.Profiling.Recorder rec; | |
public AllocCounter() { | |
rec = Recorder.Get("GC.Alloc"); |
This file contains hidden or 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 System; | |
using System.Collections.Generic; | |
using TMPro; | |
using Unity.Cinemachine; | |
using UnityEngine; | |
using UnityEngine.UI; | |
using UnityUtils; | |
[DisallowMultipleComponent] | |
public class EnemyWorldUI : MonoBehaviour { |
This file contains hidden or 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
#if UNITY_EDITOR | |
using UnityEditor; | |
using UnityEngine; | |
public static class FogColorSynchronization | |
{ | |
private const string EnableSyncMenuItemPath = "CONTEXT/Camera/Enable Synchronize Fog Color"; | |
private const string DisableSyncMenuItemPath = "CONTEXT/Camera/Disable Synchronize Fog Color"; | |
private enum ColorChange |
This file contains hidden or 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
#if UNITY_EDITOR | |
using System; | |
using System.Reflection; | |
using UnityEditor; | |
using UnityEngine; | |
public class FullscreenHotkeyHandler : MonoBehaviour | |
{ | |
bool makeFullscreenAtStart = true; |
This file contains hidden or 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 System; | |
using UnityEngine; | |
using UnityEngine.AddressableAssets; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
using UnityEditor.AddressableAssets; | |
using UnityEditor.AddressableAssets.Settings; | |
#endif | |
public class SingletonScriptable<T> : ScriptableObject where T : SingletonScriptable<T> |
This file contains hidden or 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 System; | |
using System.Collections.Generic; | |
public struct Either<TLeft, TRight> { | |
readonly TLeft left; | |
readonly TRight right; | |
readonly bool isRight; | |
Either(TLeft left, TRight right, bool isRight) { | |
this.left = left; |
This file contains hidden or 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 UnityEditor; | |
using UnityEngine; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
[InitializeOnLoad] | |
public static class HierarchyIconDrawer { | |
static readonly Texture2D requiredIcon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/_Project/Art/RequiredIcon.png"); |
This file contains hidden or 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; | |
// MB: Simple procedural audio generator. | |
// Generates a pure sine wave/tone at a given frequency. | |
public class SimpleAudioGenerator : MonoBehaviour | |
{ | |
int outputSampleRate; | |
const float TAU = Mathf.PI * 2.0f; |
This file contains hidden or 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; | |
using UnityUtils; | |
[RequireComponent(typeof(TriggerArea))] | |
public class GravityWell : MonoBehaviour { | |
TriggerArea triggerArea; | |
void Start() { | |
triggerArea = GetComponent<TriggerArea>(); | |
} |
This file contains hidden or 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 System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.LowLevel; | |
using UnityEngine.PlayerLoop; | |
namespace ImprovedTimers { | |
public static class TimerManager { | |
static readonly List<Timer> timers = new(); |
NewerOlder