Skip to content

Instantly share code, notes, and snippets.

View NeatWolf's full-sized avatar

NeatWolf NeatWolf

View GitHub Profile
@hodzanassredin
hodzanassredin / Traits.cs
Created October 9, 2011 10:43
c# trait mixins via intefaces and extension methods
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Traits;
namespace TraitsMixin
{
//trait Similarity
public interface TraitSimilarity {
@ftvs
ftvs / CameraShake.cs
Last active September 26, 2024 07:16
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
@TocaLucas
TocaLucas / ReplaceMaterials.cs
Last active September 8, 2019 15:45
Unity3D Material Replace Editor
using UnityEngine;
using UnityEditor;
public class ReplaceMaterials : EditorWindow {
static int goCount = 0, replaceCount = 0;
private Material currentMaterial = null;
private Material replaceMaterial = null;
[MenuItem("Stuff/Replace Materials")]
public static void ShowWindow() {
EditorWindow.GetWindow(typeof(ReplaceMaterials));
using UnityEngine;
using System.Reflection;
/// <summary>
/// Automatically provides a version number to a project and displays
/// it for 20 seconds at the start of the game.
/// </summary>
/// <remarks>
/// Change the first two number to update the major and minor version number.
@noisecrime
noisecrime / AssignSceneName
Created June 21, 2014 19:51
Unity - Adding commands to component context/cog menu.
// NoiseCrime Gist
// 2014.06.21
// Unity Version: 3.5.7+
// This script demonstrates how you can use MenuItem to append commands to a script component context menu.
// The new commands will be available by right-clicking on a component header or clicking the little cog icon.
// Docs: http://docs.unity3d.com/ScriptReference/MenuItem.html
// Note: You must use the current class name/type in both the MenuItem and where the context is used in the code.
@mstevenson
mstevenson / ConfigurableJointExtensions.cs
Created October 24, 2014 07:14
Extension methods for working with Configurable Joints for Unity
using UnityEngine;
public static class ConfigurableJointExtensions
{
/// <summary>
/// Sets a joint's targetRotation to match a given local rotation.
/// The joint transform's local rotation must be cached on Start and passed into this method.
/// </summary>
public static void SetTargetRotationLocal (this ConfigurableJoint joint, Quaternion targetLocalRotation, Quaternion startLocalRotation)
{
@FullStackForger
FullStackForger / .gitignore
Last active October 24, 2024 12:26
.gitignore for Unity3d project
###
# Unity folders and files
###
[Aa]ssets/AssetStoreTools*
[Bb]uild/
[Ll]ibrary/
[Ll]ocal[Cc]ache/
[Oo]bj/
[Tt]emp/
[Uu]nityGenerated/
@cjddmut
cjddmut / EasingFunctions.cs
Last active November 6, 2024 17:11
Easing Functions for Unity3D
/*
* Created by C.J. Kimberlin
*
* The MIT License (MIT)
*
* Copyright (c) 2019
*
* 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
@shayded-exe
shayded-exe / ScriptableObjectPropertyDrawer.cs
Last active September 4, 2020 15:12
Put this script in your Editor folder. Then right click on any inspector field that accepts a ScriptableObject to create an asset for it. The asset will also automatically be assigned to the field.
using System;
using System.IO;
using System.Linq;
using System.Linq.Extensions;
using UnityEditor;
using UnityEngine;
namespace PachowStudios.BadTummyBunny.Editor
{
[CustomPropertyDrawer(typeof(ScriptableObject), true)]
@samsheffield
samsheffield / UnityCodingCheatSheet.txt
Last active November 13, 2024 10:12
Unity C# Cheat Sheet
// Unity C# Cheat Sheet
// I made these examples for students with prior exerience working with C# and Unity.
// Too much? Try Unity's very good tutorials to get up to speed: https://unity3d.com/learn/tutorials/topics/scripting