blob: 72853881ac98f9d9e902df4e99ea33ea46a3bcff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
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;
}
}
}
|