Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / PreZ Standard Fade.shader
Created January 2, 2022 20:56
Standard Shader with ZWrite prepass
// https://forum.unity.com/threads/standard-shader-fade-white-still-transparent.458575/
Shader "Custom/PreZ Standard Fade" {
    Properties {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Glossiness ("Smoothness", Range(0,1)) = 0.5
        _Metallic ("Metallic", Range(0,1)) = 0.0
    }
    SubShader {
        Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjectors"="True"}
@unitycoder
unitycoder / AmbientCGToUnity.cs
Created January 3, 2022 09:34
AmbientCG to Unity texture converter
// https://forum.unity.com/threads/free-ambientcg-to-unity-texture-converter.1219455/
#pragma warning disable CA1416
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.IO.Compression;
using System.Linq;
@unitycoder
unitycoder / EditorScript.cs
Created January 4, 2022 08:09
Editor Script Template Unity
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace UnityLibrary
{
public class EditorScript : EditorWindow
{
[MenuItem("Tools/UnityLibrary/EditorScript")]
@unitycoder
unitycoder / CustomBuildProcessor.cs
Created January 4, 2022 09:25
custom build scene process IProcessSceneWithReport
// https://forum.unity.com/threads/what-is-possible-to-do-from-iprocessscenewithreport-onprocessscene.710237/
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
 
class CustomBuildProcessor : IProcessSceneWithReport
{
    public int callbackOrder { get { return 0; } }
    public void OnProcessScene(UnityEngine.SceneManagement.Scene scene, BuildReport report)
@unitycoder
unitycoder / SquareWin11.cs
Created January 13, 2022 09:01
win11 make window square (no rounded borders)
// https://forum.unity.com/threads/prevent-rounded-corners-in-win11-windowed-apps.1223718/
public class Main : MonoBehaviour
{
    // The enum flag for DwmSetWindowAttribute's second parameter, which tells the function what attribute to set.
    public enum DWMWINDOWATTRIBUTE
    {
        DWMWA_WINDOW_CORNER_PREFERENCE = 33
    }
 
    // The DWM_WINDOW_CORNER_PREFERENCE enum for DwmSetWindowAttribute's third parameter, which tells the function
@unitycoder
unitycoder / MobileVRHighlight.shader
Created January 17, 2022 07:25 — forked from bgolus/MobileVRHighlight.shader
A mobile VR and MSAA friendly single object highlight shader using the stencil buffer
Shader "Mobile VR Highlight" {
Properties {
_ColorOutline ("Outline", Color) = (1,1,1,1)
_ColorInterior ("Interior", Color) = (0.25,0.25,0.25,0.25)
_ColorInteriorFaded ("Interior Faded", Color) = (0.1,0.1,0.1,0.1)
_ColorInteriorOcc ("Interior Occluded", Color) = (0.15,0.15,0.15,0.15)
_ColorInteriorOccFaded ("Interior Occluded Faded", Color) = (0.05,0.05,0.05,0.05)
_PulseRateMod ("Pulse Rate Modifier", Float) = 4.0
_OutlneWidth ("Outline Pixel Width", Float) = 1.0
}
@unitycoder
unitycoder / LoadDDS.cs
Created January 19, 2022 10:04
Async DDS, PNG loader unity
// https://forum.unity.com/threads/tga-loader-for-unity3d.172291/
using UnityEngine;
using System.IO;
using System;
 
public static class LoadDDS
{
    public static Texture2D Load(string path)
    {
        try
@unitycoder
unitycoder / FileCopy.cs
Created January 20, 2022 08:17
Copy files between projects (unity)
// // https://forum.unity.com/threads/shared-script-to-copypaste-files-and-directories.1227576/
// This script allows you to copy and paste files or directories between editors.
// The paths of the copied files are stored in a Textfile that you define (here: "D:/UnityCopyFile.txt")
// Metafiles also get copied.
// Only works on the right column of the "Project"-tab (Two column layout).
// Do a rightclick there and see "FileCopy" and "FilePaste" entries
// Place this script in a folder named "Editor".
// Feel free to use and improve + share this script.
using UnityEngine;
@unitycoder
unitycoder / .gitattributes
Last active March 22, 2022 12:00
unity LFS gitattributes
# https://raw.githubusercontent.com/Unity-Technologies/SpaceshipDemo/master/.gitattributes
# Mesh Files
*.fbx filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
# Image Files
*.psd filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.bmp filter=lfs diff=lfs merge=lfs -text