summaryrefslogtreecommitdiff
path: root/VRCSDK3Worlds/Assets/MeshBaker/scripts/MB3_DisableHiddenAnimations.cs
diff options
context:
space:
mode:
Diffstat (limited to 'VRCSDK3Worlds/Assets/MeshBaker/scripts/MB3_DisableHiddenAnimations.cs')
-rw-r--r--VRCSDK3Worlds/Assets/MeshBaker/scripts/MB3_DisableHiddenAnimations.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/VRCSDK3Worlds/Assets/MeshBaker/scripts/MB3_DisableHiddenAnimations.cs b/VRCSDK3Worlds/Assets/MeshBaker/scripts/MB3_DisableHiddenAnimations.cs
new file mode 100644
index 00000000..72853881
--- /dev/null
+++ b/VRCSDK3Worlds/Assets/MeshBaker/scripts/MB3_DisableHiddenAnimations.cs
@@ -0,0 +1,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;
+ }
+ }
+}