Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / SpatialHash.cs
Created March 11, 2023 12:18 — forked from gamemachine/SpatialHash.cs
Spatial Hash
using Unity.Mathematics;
namespace GameCommon.Spatial
{
public struct SpatialHash
{
public const int Goffset = 10000;
public const int Max = 20480;
public int CellSize;
@unitycoder
unitycoder / HideFlagsUtility.cs
Created March 7, 2023 12:15 — forked from FlaShG/HideFlagsUtility.cs
Shows all GameObjects in the scene with hideFlags, so you can debug them.
using UnityEngine;
using UnityEditor;
public static class HideFlagsUtility
{
[MenuItem("Help/Hide Flags/Show All Objects")]
private static void ShowAll()
{
var allGameObjects = Object.FindObjectsOfType<GameObject>();
foreach (var go in allGameObjects)
@unitycoder
unitycoder / PrefabDetector.cs
Created March 5, 2023 09:43 — forked from idbrii/PrefabDetector.cs
A Unity editor window to show you the prefab-ness of an object
// public domain
// Add to Scripts/Editor/PrefabDetector.cs
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System;
using UnityEditor.Experimental.SceneManagement;
using UnityEditor.SceneManagement;
using UnityEditor;
using UnityEngine;
@unitycoder
unitycoder / DoomGlow.cs
Created February 17, 2023 10:37 — forked from TiliSleepStealer/DoomGlow.cs
Doom glow - fake volumetric light glow effect in Unity by Tili_us
// This file is in the public domain. Where
// a public domain declaration is not recognized, you are granted
// a license to freely use, modify, and redistribute this file in
// any way you choose.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Unity remake of a fake volumetric light glow effect
@unitycoder
unitycoder / VTRequest.cs
Created February 12, 2023 09:25 — forked from NanyiJiang/VTRequest.cs
Unity Streaming Virtual Texture Request improvement
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
#if ENABLE_VIRTUALTEXTURES
using VT = UnityEngine.Rendering.VirtualTexturing;
#endif
// [ExecuteInEditMode]
public class VTRequester : MonoBehaviour
@unitycoder
unitycoder / CC-Glass.shader
Created February 9, 2023 08:00 — forked from cs-altshift/CC-Glass.shader
Crying Suns Command-Center Glass Shader
Shader "Crying Suns/Command Center Glass"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture (ignored)", 2D) = "white" {}
[NoScaleOffset] _ReflectionTex ("Reflection Texture", 2D) = "black" {}
_ReflectionAlpha ("Reflection Alpha", Range(0, 1)) = 0.25
_ReflectionScale ("Reflection Scale", Range(0, 1)) = 1
[HideInInspector] _SunCenteredViewportPos ("Sun Centered Viewport Position", Vector) = (0, 0, 0, 0)
[HideInInspector] _SunAngle ("Sun Angle", Float) = 0
@unitycoder
unitycoder / ScreenSpaceNormals.shader
Created February 9, 2023 08:00 — forked from cs-altshift/ScreenSpaceNormals.shader
Screen-space normals shader for Unity - Compatible with URP
Shader "Unlit/Screen Space Normals"
{
Properties
{
}
SubShader
{
Tags { "RenderType"="Opaque" }
Pass
@unitycoder
unitycoder / ExtendedColors.cs
Created February 9, 2023 08:00 — forked from cs-altshift/ExtendedColors.cs
Extended Colors for Unity
using UnityEngine;
namespace AltShift.Productivity
{
// Extracted from: https://www.december.com/html/spec/colorpercompact.html
public static class ExtendedColor
{
public static Color _100_euro = new Color(0.53f, 0.78f, 0.49f);
public static Color _20_pound = new Color(0.64f, 0.4f, 0.51f);
public static Color _6_ball = new Color(0.11f, 0.39f, 0.33f);
@unitycoder
unitycoder / SeededRandomNumberGenerator.cs
Created February 9, 2023 07:59 — forked from cs-altshift/SeededRandomNumberGenerator.cs
C# Allocation-free Seeded Random Number Generator
using System;
namespace AltShift.Maths.Randomization
{
// No-alloc version coded from Random source code
// https://referencesource.microsoft.com/#mscorlib/system/random.cs
public unsafe struct SeededRandomNumberGenerator
{
private const int MSEED = 161803398;
private const int MZ = 0;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class TestRendererFeature : ScriptableRendererFeature
{
private TestRenderPass testRenderPass;
public Material fogMaterial;
public Color fogColor;