Firstborn/Assets/MeshBaker/scripts/MB3_DisableHiddenAnimations.cs
Schaken-Mods 959e80cf72 assets upload
assets upload description.
2023-03-28 12:16:30 -05:00

26 lines
748 B
C#

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MB3_DisableHiddenAnimations : MonoBehaviour {
public List<Animation> animationsToCull = new List<Animation>();
void Start () {
if (GetComponent<SkinnedMeshRenderer> () == null) {
Debug.LogError ("The MB3_CullHiddenAnimations script was placed on and object " + name + " which has no SkinnedMeshRenderer attached");
}
}
void OnBecameVisible(){
for (int i = 0; i < animationsToCull.Count; i++) {
if (animationsToCull[i] != null) animationsToCull[i].enabled = true;
}
}
void OnBecameInvisible(){
for (int i = 0; i < animationsToCull.Count; i++) {
if (animationsToCull[i] != null) animationsToCull[i].enabled = false;
}
}
}