Skip to content

Instantly share code, notes, and snippets.

@unitycoder
unitycoder / CustomThumbnail.cs
Created April 7, 2024 09:18
Save Thumbnails for Scenes (unity editor script)
using System.IO;
using UnityEditor;
using UnityEngine;
namespace UnityLibrary
{
[CustomEditor(typeof(SceneAsset))]
public class CustomThumbnail : Editor
{
public override bool HasPreviewGUI() => true;
@darktable
darktable / Loggers.cs
Created July 31, 2023 01:47 — forked from thygrrr/Loggers.cs
A zero-boilerplate static logger for Unity in 25 lines of code
//SPDX-License-Identifier: Unlicense OR CC0-1.0+
using System;
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
// ReSharper disable MemberCanBePrivate.Global
namespace Loggers
{
/// <summary>
// https://forum.unity.com/threads/building-an-accurate-clock-that-will-stay-accurate-over-time.1436062/
using System;
using UnityEngine;
using TimeUtil = UnityEngine.Time;
using Debug = UnityEngine.Debug;
 
public class ReliableTime : MonoBehaviour {
 
  [SerializeField] [Range(0f, 100f)] float _timeScale = 1f;
 
@silenciocorner
silenciocorner / FMODUnityCheatsheet.cs
Created March 18, 2021 08:25
FMOD Unity Cheat Sheet с комментариями
using FMODUnity;
using FMOD.Studio;
//Типы включены в этот документ для справки и не должны явно включаться в функциональный код//
//воспроизводит звуковое событие с фиксированным местоположением (опционально)//
RuntimeManager.PlayOneShot(string soundEventPath, [optional]Vector3 startLocation);
//воспроизводит звуковое событие с привязкой к объекту//
RuntimeManager.PlayOneShotAttached(string soundEventPath, Gameobject targetObject);
@ryanmillerca
ryanmillerca / PlatformBrancher.cs
Last active July 28, 2020 13:23
A simple script that lets you call UnityEvents based on the current platform (Windows, Mac, Debug, Steam, etc)
using UnityEngine;
using UnityEngine.Events;
public class PlatformBrancher : MonoBehaviour
{
public PlatformEvent[] onEnable;
public PlatformEvent[] onStart;
public PlatformEvent[] onDisable;
[Tooltip("to be called manually via PlatformBrancher.OnInvoke()")]
public PlatformEvent[] onInvoke;
@lordlycastle
lordlycastle / LayerMaskDrawer.cs
Created May 6, 2020 09:02
Better Layer Mask Drawer for Unity with Odin.
// ===============================
// AUTHOR : John Leonard
// CREATE DATE : 25.04.2020
// NOTE : Always include this
// Header when copying the file
// ===============================
// Licence: MIT (https://opensource.org/licenses/MIT)
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
@Froghut
Froghut / OdinWatchWindow.cs
Last active January 25, 2025 07:31
Odin Watch Window
#if ODIN_INSPECTOR
using System;
using System.Collections.Generic;
using System.Linq;
using Sirenix.OdinInspector.Editor;
using Sirenix.Utilities;
using Sirenix.Utilities.Editor;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
@lordlycastle
lordlycastle / KeyValueContainer.cs
Last active November 4, 2022 00:47
A container class that wraps around `KeyValuePair` to make it "mutable". Also Unity inspector friendly.
/// <summary>
/// A container class which encapsulates the KeyValuePair so it shows up in the editor.
/// Also allows us to update key and value without much hassle.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[Serializable]
public class KeyValuePairContainer<TKey, TValue>
{
/// <summary>
@judah4
judah4 / CharacterMovementBehavior.cs
Last active September 15, 2024 13:46
KineMovement implements the BaseCharacterController for Kine Character Controller. Follow how SetInput get the input and preps to apply it in the method UpdateVelocity for the CharcterController. This gets set in PlayerControlsVisualizer for the client side through the character visualizer. Same with the server and remote client behaviors in Cha…
using Improbable;
using UnityEngine;
using Improbable.Character;
using Improbable.Gdk.GameObjectRepresentation;
using Improbable.Gdk.TransformSynchronization;
using Improbable.Worker.CInterop;
public class CharacterMovementBehavior : MonoBehaviour {
[Require]