Skip to content

Instantly share code, notes, and snippets.

View tommensink's full-sized avatar

Tom Mensink tommensink

  • Netherlands
View GitHub Profile
@mattyellen
mattyellen / UnityAsyncOperationAwaiter.cs
Created July 26, 2020 19:36
Allows the use of async/await (instead of yield) with any Unity AsyncOperation
public static class ExtensionMethods
{
public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp)
{
var tcs = new TaskCompletionSource<object>();
asyncOp.completed += obj => { tcs.SetResult(null); };
return ((Task)tcs.Task).GetAwaiter();
}
}
@reneabreu
reneabreu / AutoHideSplashScreen.cs
Last active December 16, 2022 12:17
I always forget to check if Unity's splashscreen is activated, so here is a Pre-Process Build to check if i'm using Unity Plus/Pro and deactivate it for me.
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using UnityEditor.Build;
#if UNITY_2017
class AutoHideSplashScreen : IPreprocessBuild
{
public int callbackOrder { get { return 0; } }
public void OnPreprocessBuild(BuildTarget target, string path) {
@runewake2
runewake2 / HologramShader.shader
Created August 17, 2017 05:28
A sample hologram shader built as a part of World of Zero during this video: https://youtu.be/vlYGmVC_Qzg
// Hologram Shader built for World of Zero
Shader "World of Zero/Hologram"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1, 0, 0, 1)
_Bias("Bias", Float) = 0
_ScanningFrequency ("Scanning Frequency", Float) = 100
using UnityEngine;
using System.Collections.Generic;
[RequireComponent(typeof(MeshRenderer))]
[RequireComponent(typeof(MeshFilter))]
public class GridMesh : MonoBehaviour
{
public int GridSize;
void Awake()