Skip to content

Instantly share code, notes, and snippets.

Avatar

pharan pharan

View GitHub Profile
@pharan
pharan / SkeletonLit.shader
Created May 26, 2017
Legacy version of Spine's Skeleton Lit shader from 3.5.
View SkeletonLit.shader
Shader "Spine/Skeleton Lit" {
Properties {
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[NoScaleOffset] _MainTex ("Texture to blend", 2D) = "black" {}
}
// 2 texture stage GPUs
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
@pharan
pharan / AtlasRegionAttacher.cs
Created May 19, 2017
Deprecated AtlasRegionAttacher.cs from Spine-Unity for Spine 3.5
View AtlasRegionAttacher.cs
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / CustomSkin.cs
Created May 19, 2017
Deprecated CustomSkin.cs file from Spine-Unity for Spine 3.5
View CustomSkin.cs
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / MoveDrawOrderMethod.cs
Created May 16, 2017
Spine 3.4 - 3.6 DrawOrder change method(s).
View MoveDrawOrderMethod.cs
/// <summary>
/// Moves a given slot in the drawOrder. drawOrderOffset is the number of places to move the slot in the draw order. Positive values means the slot is drawn later.
/// </summary>
public static void MoveDrawOrder (Skeleton skeleton, string slotName, int drawOrderOffset) {
Slot slot = skeleton.FindSlot(slotName);
if (slot == null) return; // Do nothing if slot is not found.
var drawOrder = skeleton.DrawOrder;
int oldIndex = drawOrder.IndexOf(slot);
int newIndex = oldIndex + drawOrderOffset;
@pharan
pharan / Skeleton PMAMultiply.shader
Created Mar 3, 2017
Multiply blend mode shader for Spine.
View Skeleton PMAMultiply.shader
// Spine/Skeleton PMA Multiply
// - single color multiply tint
// - unlit
// - Premultiplied alpha Multiply blending
// - No depth, no backface culling, no fog.
// - ShadowCaster pass
Shader "Spine/Skeleton PMA Multiply" {
Properties {
_Color ("Tint Color", Color) = (1,1,1,1)
@pharan
pharan / SampleManualUpdate.cs
Created Jan 9, 2017
A sample MonoBehaviour for Spine-Unity that holds a collection of SkeletonAnimation components and updates their animation at a certain limited rate.
View SampleManualUpdate.cs
using UnityEngine;
using System.Collections.Generic;
namespace Spine.Unity.Examples {
public class SampleManualUpdate : MonoBehaviour {
[Range(0f, 1/8f)]
[Tooltip("To specify a framerate, type 1/framerate in the inspector text box.")]
public float timeBetweenFrames = 1f/24f; //24 fps
public List<SkeletonAnimation> components;
@pharan
pharan / ThreadedSkeletonDataAssetLoader.cs
Created Dec 17, 2016
Test code for spine-unity threaded loading of Spine Skeleton json and binary data.
View ThreadedSkeletonDataAssetLoader.cs
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / DEBUG_AnimationStateSceneView.cs
Last active Dec 15, 2016
Quick and dirty Spine.AnimationState SceneView debug. This logs the current state of the AnimationState tracks.
View DEBUG_AnimationStateSceneView.cs
using UnityEngine;
using System.Text;
public class DEBUG_AnimationStateSceneView : MonoBehaviour {
public bool follow = true;
}
#if UNITY_EDITOR
namespace Spine.Unity.Debugger {
[UnityEditor.CustomEditor(typeof(DEBUG_AnimationStateSceneView))]
@pharan
pharan / AnimationState.cs
Last active Apr 4, 2017
Alternate Spine 3.5 AnimationState.cs that disables multiple mixing from in favor of eliminating the setup pose dip.
View AnimationState.cs
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / SpineRootMotion.cs
Last active Oct 12, 2018
Experimental Spine.Unity.Modules.SpineRootMotion for SkeletonAnimation
View SpineRootMotion.cs
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of