Skip to content

Instantly share code, notes, and snippets.

View Anthelmed's full-sized avatar

Anthelme Dumont Anthelmed

View GitHub Profile
@Anthelmed
Anthelmed / BlendingSurfaceShader.shader
Created September 6, 2017 13:20
Unity blending shader prototype
Shader "Custom/BlendingSurfaceShader" {
Properties {
[NoScaleOffset] _NoiseTex ("Noise", 2D) = "white" {}
[NoScaleOffset] _BottomDiffuseTex ("Bottom diffuse", 2D) = "white" {}
[NoScaleOffset] [Normal] _BottomNormalTex ("Bottom normal", 2D) = "bump" {}
[NoScaleOffset] _MiddleDiffuseTex ("Middle diffuse", 2D) = "white" {}
[NoScaleOffset] [Normal] _MiddleNormalTex ("Middle normal", 2D) = "bump" {}
@Anthelmed
Anthelmed / WRL loader and parser
Last active April 2, 2018 21:03
WRL loader/parser es6
/**
* WRLLoader class
*/
class WRLLoader {
/**
* load method
* @returns {Promise}
*/
load(path) {
const xhr = new XMLHttpRequest();
@Anthelmed
Anthelmed / ReplaceDuplicateMeshesEditorWindow
Last active October 3, 2020 17:29
Unity - Find and replace meshes that are identical but use different assets
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace AnthelmeDumontTools
{
public class ReplaceDuplicateMeshesEditorWindow : EditorWindow
{
private GameObject[] _selectedObjects;
Shader "Custom/SilhouetteShader"
{
Properties
{
_SilhouetteColor("Silhouette Color", Color) = (0,1,0,1)
}
SubShader
{
Tags{"Queue"="Geometry+1" "RenderType" = "Geometry"}
@Anthelmed
Anthelmed / Animation
Created December 10, 2021 18:44
Using Unity UIToolkit transition animation system to animate a GameObject
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.UIElements.Experimental;
public class Animation : MonoBehaviour
{
[SerializeField] private Transform transform;
[SerializeField] private UIDocument uiDocument;
[SerializeField] private int durationMs = 3000;
@Anthelmed
Anthelmed / MainMenu.cs
Created January 28, 2022 09:52
MainMenu
using System;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.UIElements;
public class MainMenu : MonoBehaviour
{
[SerializeField] private UIDocument mainMenuUIDocument;
[SerializeField] private Material buttonHoverMaterial;
@Anthelmed
Anthelmed / Menu Button Custom Render Texture.shader
Last active January 28, 2022 09:52
Menu Button Custom Render Texture
Shader "CustomRenderTexture/Menu Button Custom Render Texture"
{
Properties
{
_NoiseScale("Noise Scale", float) = 1
_NoiseStrength("Noise Strength", float) = 0.1
_NoiseSpeed("Noise Speed", float) = 0.1
_NoiseOffset("Noise Offset", float) = 0
}
@Anthelmed
Anthelmed / FileUtils.cs
Last active February 8, 2022 21:35
Unity Read/Write SaveAsync/LoadAsync streamingAssets file utils
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json; // https://docs.unity3d.com/Packages/com.unity.nuget.newtonsoft-json@2.0/manual/index.html
using UnityEngine;
public static class FileUtils
{
public static string RootDirectory
{
@Anthelmed
Anthelmed / Searchbar
Created March 10, 2022 21:40
Searchbar code example for the medium article on UIToolkit
@Anthelmed
Anthelmed / Router.cs
Created April 26, 2022 22:09
Router example
using System;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Router
{
public static class SceneRouter
{
public enum SceneType