Skip to content

Instantly share code, notes, and snippets.

@solkar
solkar / Exercises.md
Last active December 24, 2020 13:00
Tony Williams style analysis and exercises
@solkar
solkar / BakeStaticCubemap.cs
Created July 17, 2017 13:24
Bake into Cubemap Unity Editor Script
/*
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2014 ARM Limited
* ALL RIGHTS RESERVED
* The entire notice above must be reproduced on all authorised
* copies and copies may only be made to the extent permitted
* by a licensing agreement from ARM Limited.
*/
@solkar
solkar / EventClassWithoutEvent.cs
Last active July 13, 2017 06:45
Subscribing for events using lambda expressions
public class EventClassWithoutEvent
{
public Action OnChange { get; set; }
public void Raise()
{
if (OnChange != null)
{
OnChange();
}
}
@solkar
solkar / ClearShaderCache.cs
Created May 19, 2017 08:52
UnityEditor script to clear shader cache
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
public class ClearShaderCache : MonoBehaviour
{
[MenuItem("Tools/Clear shader cache")]
Shader "Name" {
Properties {
name ("display name", Range (min, max)) = number
name ("display name", Float) = number
name ("display name", Int) = number
name ("display name", Color) = (number,number,number,number)
name ("display name", Vector) = (number,number,number,number)
@solkar
solkar / FreeCamera.cs
Created May 1, 2017 09:40
Basic demo camera for Unity
//
// Controls:
// - Enable free look with right mouse button
//
//
using UnityEngine;
public class FreeCamera : MonoBehaviour {
public bool enableInputCapture = true;
@solkar
solkar / FreeCamera.cs
Created May 1, 2017 09:40
Basic demo camera for Unity
//
// Controls:
// - Enable free look with right mouse button
//
//
using UnityEngine;
public class FreeCamera : MonoBehaviour {
public bool enableInputCapture = true;
@solkar
solkar / EnvPresetChooser.cs
Created May 1, 2017 08:34
Camera Presets selection and Screeshot dump - from Unity3D Blacksmith demo
using UnityEngine;
using System.Collections;
using System.Linq;
public class EnvPresetChooser : MonoBehaviour {
public Transform[] presets { get { return transform.Cast<Transform>().ToArray(); } }
public int GetActivePreset() {
for(int i = 0, n = transform.childCount; i < n; ++i)
if(transform.GetChild(i).gameObject.activeSelf)
@solkar
solkar / EnableLatentFrame.cs
Created April 21, 2017 10:41
HoloLens Latent Frame ON
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnableLatentFrame : MonoBehaviour
{
void Start () {
UnityEngine.VR.WSA.HolographicSettings.ActivateLatentFramePresentation( true );
}
@solkar
solkar / DisableAnimations.cs
Created April 20, 2017 04:53
Disable animation from AssetImporter
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class DisableAnimations : AssetPostprocessor
{
void OnPreprocessModel()
{
var modelImporter = assetImporter as ModelImporter;