Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@bgolus
bgolus / WorldNormalFromDepthTexture.shader
Last active March 5, 2025 00:57
Different methods for getting World Normal from Depth Texture, without any external script dependencies.
Shader "WorldNormalFromDepthTexture"
{
Properties {
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@dustingraham
dustingraham / ScriptableObjectWithId.cs
Created February 2, 2021 16:55
ScriptableObject with GUID
// Reference: https://github.com/Bunny83/UUID/blob/master/UUID.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
public class RaycastCommandRaycaster: IDisposable
{
NativeArray<RaycastCommand> commands;
NativeArray<RaycastHit> results;
@svpino
svpino / neural-network-from-scratch.py
Last active December 13, 2024 20:19
An implementation of a neural network from scratch
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def neural_network(X, y):
learning_rate = 0.1
W1 = np.random.rand(2, 4)
W2 = np.random.rand(4, 1)
@hybridherbst
hybridherbst / SetThreadCount.cs
Created January 15, 2021 15:56
Set the number of concurrent compiler threads for Unity3D
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
public static class SetThreadCount
{
[InitializeOnLoadMethod]
static void Init()
{
@dorodo95
dorodo95 / GenerateVectorData.cs
Last active July 11, 2023 00:20
Object Smearing via Shader
using UnityEngine;
public class GenerateVectorData : MonoBehaviour
{
private SkinnedMeshRenderer m_mesh;
private Mesh skinnedMeshCache;
private Vector3[] vertexFrameCache1;
private Vector3[] vertexFrameCache2;
private Vector3[] vertexFrameCache3;
private ComputeBuffer vertexBuffer1;
@elringus
elringus / FileWatcher.cs
Last active November 1, 2024 05:53
Allows executing an editor behaviour in response to file modificatons, even when editor application is not in focus.
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
/// <summary>
/// Uses file system watcher to track changes to specific files in the project directory.
@tolotratlt
tolotratlt / BlendCubedSkybox.shader
Last active July 6, 2024 18:12
Blending 6 sided skybox using Unity3D fragment shader
/*Blending 6 Sided skybox. By tlt*/
Shader "Skybox/VertBlendedSkybox"
{
Properties{
_Tint("Tint Color", Color) = (.5, .5, .5, .5)
[Gamma] _Exposure("Exposure", Range(0, 8)) = 1.0
_Rotation("Rotation", Range(0, 360)) = 0
_Blend("Blend", Range(0.0,1.0)) = 0.5
@Refsa
Refsa / GrabScreenFeature.cs
Last active May 30, 2025 15:30
Unity URP custom grab pass
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class GrabScreenFeature : ScriptableRendererFeature
{
[System.Serializable]
public class Settings
@stonstad
stonstad / UnityUtils.cs
Created September 22, 2020 17:15
Locate Unity Assets Which Contain Broken References
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
using System.Linq;
using System.Threading.Tasks;
public class UnityUtils: MonoBehaviour
{
[MenuItem("Tools/Find Broken GUIDs")]