Skip to content

Instantly share code, notes, and snippets.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EventCallPerformanceTest : MonoBehaviour {
private System.Diagnostics.Stopwatch _stopwatch;
void Start () {
if (_audioSource.timeSamples >= _audioSource.clip.samples - 1) {
StopPlayingAndFinish();
}
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
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)
@Split82
Split82 / CheckNullReferences.cs
Last active July 24, 2018 17:00
Find all null references in game objects, prefabs and scriptable objects.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.Linq;
using System.Reflection;
using UnityEngine.SceneManagement;
public class CheckNullReferences {
@protocol RatingViewControllerDelegate <NSObject>
- (void)ratingViewControllerDidFinishWithOk:(RatingViewController*)ratingViewController selectedRow:(NSInteger)selectedRowIndex;
- (void)ratingViewControllerDidCancel:(RatingViewController*)ratingViewController;
@end
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)
Shader "Example/Decal" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" "Queue"="Geometry+1" "ForceNoShadowCasting"="True" }
LOD 200
Offset -1, -1
CGPROGRAM
if ([tutorialID isEqualToString:@"t1"]) {
TutorialElement *b1 = [TutorialElement elementWithName:kBoardTutElement params:nil];
b1.params = @{
@"blocks2" : @[[NSValue valueWithBoardPos:boardPosMake(1, 3)]],
@"destinations2" : @[[NSValue valueWithBoardPos:boardPosMake(5, 3)]]
};
return @[
TEXT_TE(boardPosMake(3, 3), 180.0f, NSLS(@"Welcome player!", @"")),
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
TestViewController *viewController = [[TestViewController alloc] init];
[self presentViewController:viewController animated:YES completion:nil];
}