Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System;
public class ScreenshotCamera
{
static Vector3 FocusPoint;
static float Aperture = 20.0f;
RealTimeSince timeSinceMessage;
string MessageText;
/// FloatPlotter, plots values on screen
/// by Nothke
///
/// How to use:
///
/// 1. Add this script to your main camera
/// 2. Create a FloatPlot object like:
/// FloatPlot plot = new FloatPlot(minimumValue, maximumValue, RectOnScreen);
/// 2b. Optional: you can set plot.color and plot.backgroundColor
/// 3. Push values to it, for example every Update or FixedUpdate
@valyard
valyard / TestWindow.cs
Created November 6, 2017 01:06
Export current profiler frame to Chrome Trace Event Format
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System;
using System.Text;
using System.IO;
public class TestWindow : EditorWindow
@geniikw
geniikw / CoroutineChain.cs
Last active October 18, 2022 08:00
Unity3d, CoroutineChain
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using geniikw.CChain;
using System;
using Object = UnityEngine.Object;
#region Accessor
/*
CoroutineChain (v0.2.1) author - geniikw@gmail.com
@mandarinx
mandarinx / optimizations.md
Last active September 28, 2023 03:51
Unity3D optimization tips

Unity3D optimization tips

Some code allocates memory when running in the editor and not on the device. This is due to Unity doing some extra error handling so possible error messages can be output in the console. Much of this code is stripped during build. It's therefore important to profile on device, and do it regularly.

Optimizations often makes code more rigid and harder to reason. Don't do it until you really need to.

When profiling, wrap methods or portions of a method in Profiler.BeginSample(string name) and Profiler.EndSample() to make them easier to find in the profiler.

public class SomeClass {
@yuri-tikhomirov
yuri-tikhomirov / FastList.cs
Last active October 8, 2023 20:23
FastList<T> is a System.Collections.Generic.List<T> modification such, that allows to not produce garbage when using foreach.
/*
FastList<T> is a System.Collections.Generic.List<T> modification such, that allows to not produce garbage when using foreach.
Useful for old versions of c# runtime (like Mono 2.x), i.e. for Unity.
It implements own instance-type enumerator and caches only one instance of this enumerator inside.
Instance-type enumerator allows to avoid boxing that occurs when foreach converts IEnumerator to IDisposable and calls Dispose().
(Default List<T> enumerator is value-type (struct), so when foreach converts to IDisposable, boxing occurs and 20 bytes of garbage will be collected.)
Warnings:
@ProtoJazz
ProtoJazz / BuildAndNotify.cs
Created July 26, 2015 04:13
Unity3D NotifyMyAndroid Integration
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class BuildAndNotify : MonoBehaviour
{
private static string URL = "https://www.notifymyandroid.com/publicapi/notify";
private static string apiKey = "YOUR API KEY HEERE!!!!";
//private static string toolName = "Super Awesome Tool of Ultimate Usefullness";
private const string toolName = "Build and Notify";
@cjddmut
cjddmut / EasingFunctions.cs
Last active May 31, 2024 12:55
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
@yajh
yajh / SceneSearcher.cs
Created April 14, 2014 01:53
Unity3d asset reference searcher.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
using System.Collections.Generic;
using System.Linq;
public class SceneSearcher : EditorWindow
{
@disjukr
disjukr / SplattingTerrain.shader
Created April 1, 2013 16:37
unity3d shader for terrain
Shader "Custom/SplattingTerrain"
{
Properties
{
_R ("R channel Image", 2D) = "white" {}
_G ("G channel Image", 2D) = "white" {}
_B ("B channel Image", 2D) = "white" {}
_A ("A channel Image", 2D) = "white" {}
}
SubShader