Skip to content

Instantly share code, notes, and snippets.

@coryleach
coryleach / RequestService.cs
Last active June 30, 2023 18:50
Service for Request-Response pattern style communications over the network using FishNet
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using FishNet.Broadcast;
using FishNet.Connection;
using FishNet.Managing.Client;
using FishNet.Managing.Server;
using UnityEngine;
/// <summary>

How a path is generated

Step 1

Place two 4x1 vertical stack of tiles and three 3x1 vertical stack of tiles on the grid. The order in which you place the tiles is random (so for example there would be a 2 / 5 = 40% chance that the path could end with a 4x1 line to the finish). The stacks are placed such that the top of one stack will align to the bottom of the next stack. The tips of the stacks are not allowed to intersect.

For example, after step 1 it could look like this:

|x| | | | | | | | | |
@jschieck
jschieck / FlyoutProjectWindow.cs
Last active March 2, 2024 12:43
Show a flyout project window in the scene view
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.Compilation;
using UnityEngine;
public static class FlyoutProjectWindow
{
@sabresaurus
sabresaurus / ConsoleCallStackHelper.cs
Last active May 2, 2020 09:56
Jump to file/line in the Unity console window callstack via this helper window
// MIT License
//
// Copyright (c) 2018 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active April 29, 2026 02:38
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@MerlinTwi
MerlinTwi / AppInfo.cs
Last active March 29, 2024 20:02
Auto update Unity bundleVersion and save build time
using System;
public static class AppInfo {
//--- AutoGenerated.begin
public const string Version = "1.0.3";
public static readonly DateTime Date = new DateTime(2018, 04, 29, 13, 41, 08, 331, DateTimeKind.Utc);
//--- AutoGenerated.end
}
@partlyhuman
partlyhuman / FindByGuid.cs
Last active October 11, 2024 04:50
Unity Find by GUID
using UnityEditor;
using UnityEngine;
namespace com.hololabs.editor
{
public class FindByGuid : EditorWindow
{
[MenuItem("Utility/Find Asset by Guid %&g")]
public static void DoFindByGuidMenu()
{
@TiliSleepStealer
TiliSleepStealer / DoomGlow.cs
Created June 13, 2017 21:45
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
@svermeulen
svermeulen / MultiSceneSetup.cs
Created October 23, 2016 17:32
Simple editor script to save and load multi-scene setups within Unity3D
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEditor.SceneManagement;
using UnityEditor;
using System.Collections;
using System.Linq;
public class MultiSceneSetup : ScriptableObject
{
@bcjordan
bcjordan / spiral-traversal.md
Last active April 29, 2016 17:19
Spiral Traversal problem solutions
  • Bernie Margolis in Java (gist)
  • Florent Crivello in Objective-C (gist)
  • Srismil Dutta in Javascript (gist)
  • Eran Zimbler in Javascript (gist and node.js module)
  • Maurin Lenglart in Javascript (gist)
  • Ankit Goyal in Ruby (gist, imgur clean notes, original notes)
  • Kevin Le Brun in Python (with a nice writeup and tests!) (gist), who accurately notes "I saw a typo in the second test case for the problem. You should replace '194' with '14'."
  • C is for Conrad Meyer (another C solution) (gist)
  • Péter Ferenczy in Ruby (utilizing laz