Skip to content

Instantly share code, notes, and snippets.

@haim96
haim96 / PlayerAnimator.cs
Created July 10, 2022 12:04 — forked from Matthew-J-Spencer/PlayerAnimator.cs
Control unity animations using code. Video: https://youtu.be/ZwLekxsSY3Y
using System;
using UnityEngine;
using UnityEngine.Tilemaps;
using Random = UnityEngine.Random;
public class PlayerAnimator : MonoBehaviour {
[SerializeField] private float _minImpactForce = 20;
// Anim times can be gathered from the state itself, but
// for the simplicity of the video...
@haim96
haim96 / SwipeInput.cs
Created January 2, 2022 18:26 — forked from Fonserbc/SwipeInput.cs
A simple swipe detector for touchscreens for Unity3D. Four cardinal directions.
using UnityEngine;
/*
* Swipe Input script for Unity by @fonserbc, free to use wherever
*
* Attack to a gameObject, check the static booleans to check if a swipe has been detected this frame
* Eg: if (SwipeInput.swipedRight) ...
*
*
*/
@haim96
haim96 / Unlit-CastShadow.shader
Created April 11, 2020 23:40 — forked from pigeon6/Unlit-CastShadow.shader
Unlit texture shader which casts shadow on Forward/Defered
// Unlit texture shader which casts shadow on Forward/Defered
Shader "Unlit/Texture CastShadow" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Opaque" }
LOD 100
@haim96
haim96 / Unlit-CastShadow.shader
Created April 11, 2020 23:40 — forked from pigeon6/Unlit-CastShadow.shader
Unlit texture shader which casts shadow on Forward/Defered
// Unlit texture shader which casts shadow on Forward/Defered
Shader "Unlit/Texture CastShadow" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Opaque" }
LOD 100
@haim96
haim96 / BuildNumberIncrementer.cs
Created February 11, 2020 15:43 — forked from benshippee/BuildNumberIncrementer.cs
Unity build post process script to automatically bump iOS and Android version numbers
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
public class BuildNumberIncrementer
{
[PostProcessBuild]
public static void OnBuildComplete(BuildTarget buildTarget, string pathToBuiltProject)
using UnityEngine;
using UnityEngine.EventSystems;
public class FixedButton : MonoBehaviour, IPointerUpHandler, IPointerDownHandler
{
[HideInInspector]
public bool Pressed;
// Use this for initialization
void Start()
@haim96
haim96 / MeshDestroy.cs
Created August 20, 2019 14:16 — forked from ditzel/MeshDestroy.cs
MeshDestroy => Put it on a game object with a mesh filter and renderer. Make sure to have read/write enabled on fbx import
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshDestroy : MonoBehaviour
{
private bool edgeSet = false;
private Vector3 edgeVertex = Vector3.zero;
private Vector2 edgeUV = Vector2.zero;
@haim96
haim96 / PlayerPrefsTools.cs
Created March 13, 2018 13:57 — forked from anonymous/PlayerPrefsTools.cs
Get all player prefs keys (windows only)
using System.Collections.Generic;
public class PlayerPrefsTools
{
public static void GetAllPlayerPrefKeys(ref List<string> keys)
{
if (keys != null)
{
keys.Clear();
}