Skip to content

Instantly share code, notes, and snippets.

@valyard
valyard / ProfilerRecorder.cs
Created Nov 24, 2017
Record profiling data split by files and with frame time markers added.
View ProfilerRecorder.cs
using UnityEngine;
using UnityEngine.Profiling;
using System.IO;
using UnityEngine.SceneManagement;
using System.Text;
using System;
public class ProfilerRecorder : MonoBehaviour
{
public const string START_MARKER = "PROFILER_DATA_START";
View fragment.glsl
#version 300 es
precision highp float;
precision highp int;
uniform mediump vec4 _WorldSpaceLightPos0;
uniform mediump vec4 unity_SHAr;
uniform mediump vec4 unity_SHAg;
uniform mediump vec4 unity_SHAb;
uniform mediump vec4 unity_FogColor;
uniform mediump vec4 unity_SpecCube0_HDR;
@valyard
valyard / TestWindow.cs
Created Nov 6, 2017
Export current profiler frame to Chrome Trace Event Format
View TestWindow.cs
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
@valyard
valyard / Jobs_and_ecs.cs
Created Jul 10, 2017
"Slides" about C# Job System and ESC in Unity.
View Jobs_and_ecs.cs
// ######################################################################
//
// We want you to write more efficient code
//
// ######################################################################
But, we teach the opposite...
You know, GameObjects and Components.
...
View ReflectionProbe.shader
Shader "Custom/TestShader"
{
Properties {}
SubShader
{
Tags { "RenderType"="Opaque" }
Pass
{
CGPROGRAM
@valyard
valyard / gist:8915306
Created Feb 10, 2014
Unity .gitignore
View gist:8915306
*.DS_Store
.Spotlight-V100
.Trashes
[Tt]humbs.db
/Temp/
/Obj/
/UnityGenerated/
/Library/
/Build/
@valyard
valyard / gist:8704131
Last active Aug 29, 2015
Bash recipes
View gist:8704131
# batch convert image files
for img in *.tga; do filename=${img%.*}; convert "$filename.tga" "$filename.png"; done
View gist:6374271
protected function restart(event:Event = null):void {
NativeApplication.nativeApplication.dispatchEvent( new Event(Event.EXITING) );
NativeApplication.nativeApplication.exit();
if ( NativeProcess.isSupported ) {
var app:File = File.applicationDirectory.resolvePath( App._airConfig.filename + ".exe" );
if ( !app.exists ) return;
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = app;
var process:NativeProcess = new NativeProcess();