Skip to content

Instantly share code, notes, and snippets.

@valyard
valyard / ProfilerRecorder.cs
Created November 24, 2017 14:28
Record profiling data split by files and with frame time markers added.
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";
#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 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
@valyard
valyard / Jobs_and_ecs.cs
Created July 10, 2017 20:20
"Slides" about C# Job System and ESC in Unity.
// ######################################################################
//
// We want you to write more efficient code
//
// ######################################################################
But, we teach the opposite...
You know, GameObjects and Components.
...
Shader "Custom/TestShader"
{
Properties {}
SubShader
{
Tags { "RenderType"="Opaque" }
Pass
{
CGPROGRAM
@valyard
valyard / gist:8915306
Created February 10, 2014 12:50
Unity .gitignore
*.DS_Store
.Spotlight-V100
.Trashes
[Tt]humbs.db
/Temp/
/Obj/
/UnityGenerated/
/Library/
/Build/
@valyard
valyard / gist:8704131
Last active August 29, 2015 13:55
Bash recipes
# batch convert image files
for img in *.tga; do filename=${img%.*}; convert "$filename.tga" "$filename.png"; done
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();