Skip to content

Instantly share code, notes, and snippets.

@dunenkoff
dunenkoff / AStar.cs
Created May 7, 2014 21:04
A* pathfinding implementation for Unity3D, using raycasting and colliders for obstacles
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class AStar {
// A* pathfinding
/// <summary>
/// Returns estimated cost of moving from point A to point B.
@bkaradzic
bkaradzic / orthodoxc++.md
Last active April 23, 2024 13:59
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@aras-p
aras-p / TextureArray.md
Last active February 29, 2020 08:12
Basic texture array usage in shaders in Unity 5.4

You generally want this compilation target:

// uses texture arrays, so needs DX10/ES3 which is 3.5 target
#pragma target 3.5

Inside Properties block: _MyArr ("Tex", 2DArray) = "" {}

Declare the texture array sampler inside CGPROGRAM: UNITY_DECLARE_TEX2DARRAY(_MyArr);

@nemotoo
nemotoo / .gitattributes
Last active May 2, 2024 18:33
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@UnaNancyOwen
UnaNancyOwen / CMakeLists.txt
Last active January 16, 2020 09:22
Drawing the Point Cloud retrieved from Kinect v2 using Point Cloud Library without Grabber
cmake_minimum_required( VERSION 2.8 )
set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${CMAKE_MODULE_PATH} )
project( sample )
add_executable( sample main.cpp )
set_property( DIRECTORY PROPERTY VS_STARTUP_PROJECT "sample" )
# Find Packages
find_package( PCL 1.8 REQUIRED )
find_package( KinectSDK2 REQUIRED )
@LotteMakesStuff
LotteMakesStuff / EditorCoroutineRunner.cs
Last active May 20, 2022 10:21
Run stuff in the editor with all the convenience of co-routines! Add a status UI super easily to see readouts what your long running code is actually doing! nice~ There is a short API demo at the top of the class. This is a prefect companion for my inspector buttons https://gist.github.com/LotteMakesStuff/dd785ff49b2a5048bb60333a6a125187
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class EditorCoroutineRunner
{
[MenuItem("Window/Lotte's Coroutine Runner: Demo")]
@LotteMakesStuff
LotteMakesStuff / TrafficLightAttribute.cs
Last active February 2, 2024 15:58
TrafficLight control/layout/property drawer: Adds a new editor control that draws lil Traffic Lights in the inspector. its really useful for visualizing state. For example, checkboxes can be hard to read at a glace, but a Red or Green status light is easy! Recommend you use the attached package, as it has all the icon image files.
// Non Editor code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class TrafficLightAttribute : PropertyAttribute
{
public bool DrawLabel = true;
public string CustomLabel;
public bool AlsoDrawDefault;
@smkplus
smkplus / UnityShaderCheatSheet.md
Last active May 3, 2024 10:36
Controlling fixed function states from materials/scripts in Unity

16999105_467532653370479_4085466863356780898_n

Shader "MaterialPropertyDrawer"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
 
[HideInInspector] _MainTex2("Hide Texture", 2D) = "white" {}
@5agado
5agado / grease_pencil_init.py
Last active May 5, 2022 11:03
Init method for Blender 2.8 Grease Pencil
import bpy
def get_grease_pencil(gpencil_obj_name='GPencil') -> bpy.types.GreasePencil:
"""
Return the grease-pencil object with the given name. Initialize one if not already present.
:param gpencil_obj_name: name/key of the grease pencil object in the scene
"""
# If not present already, create grease pencil object
if gpencil_obj_name not in bpy.context.scene.objects: