Skip to content

Instantly share code, notes, and snippets.

View livazz's full-sized avatar
💭
I may be slow to respond.

Ali Mehrez livazz

💭
I may be slow to respond.
View GitHub Profile
@livazz
livazz / MainLightDataNode.cs
Created December 14, 2018 08:53 — forked from bitinn/MainLightDataNode.cs
A custom node for Unity's ShaderGraph to capture lighting and use it into the shader. Works as of Dec 2018, but the APIs might change!
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
// IMPORTANT:
// - tested with LWRP and Shader Graph 4.6.0-preview ONLY
// - likely to break in SG 5.x and beyond
// - for HDRP, add your own keyword to detect environment
[Title("Custom", "Main Light Data")]
@livazz
livazz / PlayerLoop.cs
Created February 4, 2018 20:41 — forked from LotteMakesStuff/PlayerLoop.cs
Player Loop Visualizer: Built to explore the new PlayerLoopSystem api in Unity 2018.1b2. This tool shows you all the PlayerLoop systems that unity uses to update a frame, and demos how to add your own and even remove systems from the player loop. For more info see the patreon post https://www.patreon.com/posts/unity-2018-1-16336053
// Put this in an editor folder
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.LowLevel;
using UnityEngine.Profiling;
@livazz
livazz / GameCenterExamples.js
Created February 2, 2018 10:16 — forked from mehmettaskiner/GameCenterExamples.js
Gist that explains game center implementation in unity
/*
To report an achievement status use this function.
for success, achievement must be reported to 100.0
if you want to track some certain tasks, like blasted ball count.
you can calculate a percentage and when user blasted a ball,
you can report this percentage instead of 100.0
*/
Social.ReportProgress ("achievementID", 100.0, function(result) {
if (result){
Debug.Log ("Successfully reported achievement progress");
@livazz
livazz / GameCenterController.js
Created February 2, 2018 10:16 — forked from mehmettaskiner/GameCenterController.js
GameCenterController, attach this to an empty game object at your first scene.
#pragma strict
import UnityEngine.SocialPlatforms;
import UnityEngine.SocialPlatforms.GameCenter;
function Start () {
DontDestroyOnLoad(gameObject);
// Authenticate and register a ProcessAuthentication callback
// This call needs to be made before we can proceed to other calls in the Social API
Social.localUser.Authenticate (ProcessAuthentication);
GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
// Unity C# Cheat Sheet
// I made these examples for students with prior exerience working with C# and Unity.
// Too much? Try Unity's very good tutorials to get up to speed: https://unity3d.com/learn/tutorials/topics/scripting
@livazz
livazz / InspectorButtonsTest.cs
Created February 7, 2017 23:55 — forked from LotteMakesStuff/InspectorButtonsTest.cs
Code running pack! two property drawing scripts that make it super easy to trigger code via buttons in the inspector, and get feedback! [TestButton] draws you little buttons that call a method on your MonoBehaviour, and [ProgressBar] give you a great way to show feedback from long running methods. These are *super* helpful for things like proced…
using UnityEngine;
using System.Collections;
public class InspectorButtonsTest : MonoBehaviour
{
[TestButton("Generate world", "DoProcGen", isActiveInEditor = false)]
[TestButton("Clear world", "ClearWorld", 2, isActiveInEditor = false)]
[ProgressBar(hideWhenZero = true, label = "procGenFeedback")]
public float procgenProgress = -1;