Skip to content

Instantly share code, notes, and snippets.

View gakkossphynx's full-sized avatar
💯
Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work

SPHYNX gakkossphynx

💯
Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work
  • TR
View GitHub Profile
@yasirkula
yasirkula / SceneViewUIObjectPickerContextWindow.cs
Last active June 14, 2024 21:30
Select the UI object under the cursor via right click in Unity's Scene window
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_2021_2_OR_NEWER
using PrefabStage = UnityEditor.SceneManagement.PrefabStage;
using PrefabStageUtility = UnityEditor.SceneManagement.PrefabStageUtility;
@pazzaar
pazzaar / AnimatorExtensions
Last active April 6, 2024 06:02
Animator rebind function that also maintains some state
using System.Collections.Generic;
using UnityEngine;
public static class AnimatorExtensions
{
public static void RebindAndRetainState(this Animator anim)
{
List<AnimatorStateInfo> animStates = new List<AnimatorStateInfo>();
for (int i = 0; i < anim.layerCount; i++)
{
@pazzaar
pazzaar / gist:17ab22412c7045fba2e002405d6d6cdd
Created September 4, 2021 09:19
Unity mesh info including LOD levels
using UnityEngine;
using System.Collections;
using UnityEditor;
public class MeshInfo : EditorWindow
{
bool showLOD1info = false;
bool showLOD2info = false;
bool showLOD3info = false;
bool showLOD4info = false;
@totallyRonja
totallyRonja / MaterialGradientDrawer.cs
Last active September 26, 2023 09:46
A Material Property Drawer for the [Gradient] attribute which lets you edit gradients and adds them to the shader as textures. More information here: https://twitter.com/totallyRonja/status/1368704187580682240
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
public class MaterialGradientDrawer : MaterialPropertyDrawer {
private int resolution;
@andrew-raphael-lukasik
andrew-raphael-lukasik / .TextureColorFillCalculator.cs.md
Last active September 28, 2023 18:52
Texture Color Fill Calculator

test1 test2 test3 test4

@unitycoder
unitycoder / gist:199ff1dfd521bd9e9ae1e70e44e6bc5d
Last active September 25, 2021 08:14
[Fixefox GreaseMonkey Plugin Script] Fix Old Asset Store Links
// ==UserScript==
// @name Fix Old Asset Store Links
// @version 1
// @include https://www.assetstore.unity3d.com/*
// @grant none
// ==/UserScript==
// get current url
var URL = window.location.href;
@yasirkula
yasirkula / ShaderStripper.cs
Last active March 4, 2024 09:40
Stripping commonly unused shader variants in Unity's built-in render pipeline
//#define SHADER_COMPILATION_LOGGING
//#define SKIP_SHADER_COMPILATION
using System.Collections.Generic;
using UnityEditor.Build;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
public class ShaderStripper : IPreprocessShaders
@ditzel
ditzel / MeshDestroy.cs
Created August 19, 2019 19:02
MeshDestroy => Put it on a game object with a mesh filter and renderer. Make sure to have read/write enabled on fbx import
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshDestroy : MonoBehaviour
{
private bool edgeSet = false;
private Vector3 edgeVertex = Vector3.zero;
private Vector2 edgeUV = Vector2.zero;
@SradnickDev
SradnickDev / Timer.cs
Created June 14, 2019 11:23
Timer using Photon Unity Network / Pun 2
using System;
using ExitGames.Client.Photon;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
/// <summary>
/// PhotonNetwork Timer, using Photon Events(RaiseEvents).
/// Call Initialize() as soon as the Timer should react to Photon Callbacks(RaiseEvents), Deinitialize if not needed.
/// Every Client should Update the Timer : timer.Update(Time.deltaTime)
@Oxeren
Oxeren / MySingletonSO.cs
Last active February 15, 2024 04:57
Auto singleton Unity ScriptableObject. Derive your class from this class (and use your class as the generic type), create an instance in the Resources folder (name of the instance must be the same as the name of your class). Then you will be able to access the singleton via static Instance property without having to add boilerplate code.
// Example Scriptable Object. Instance must be placed in Resources folder and have the same name as the class, type of generic parameter must be your class.
using UnityEngine;
[CreateAssetMenu(fileName = "MySingletonSO")]
public class MySingletonSO : SingletonScriptableObject<MySingletonSO>
{
// Here goes your data. This class can be called by the static Instance property, which will automatically locate the instance in the Resources folder.
}