Skip to content

Instantly share code, notes, and snippets.

@FNGgames
Created January 9, 2020 16:43
Show Gist options
  • Save FNGgames/c355e37c65ad70d4d6c3e78500407487 to your computer and use it in GitHub Desktop.
Save FNGgames/c355e37c65ad70d4d6c3e78500407487 to your computer and use it in GitHub Desktop.
Spine Frustrum Culling
using Spine.Unity;
using UnityEngine;
[RequireComponent(typeof(Renderer), typeof(SkeletonAnimation))]
public class SpineFrustrumCullSkeletonAnimation : MonoBehaviour
{
private SkeletonAnimation _anim;
private Renderer _renderer;
void Start()
{
_anim = GetComponent<SkeletonAnimation>();
_anim.enabled = GetComponent<Renderer>().isVisible;
}
void OnBecameVisible() => _anim.enabled = true;
void OnBecameInvisible() => _anim.enabled = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment