MB3_TestAddingRemovingSkinnedMeshes.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class MB3_TestAddingRemovingSkinnedMeshes : MonoBehaviour {
  5. public MB3_MeshBaker meshBaker;
  6. public GameObject[] g;
  7. // Use this for initialization
  8. void Start() {
  9. StartCoroutine(TestScript());
  10. }
  11. IEnumerator TestScript() {
  12. Debug.Log("Test 1 adding 0,1,2");
  13. GameObject[] a2 = new GameObject[] { g[0], g[1], g[2] };
  14. meshBaker.AddDeleteGameObjects(a2, null, true);
  15. meshBaker.Apply();
  16. meshBaker.meshCombiner.CheckIntegrity();
  17. yield return new WaitForSeconds(3f);
  18. Debug.Log("Test 2 remove 1 and add 3,4,5");
  19. GameObject[] d1 = new GameObject[] { g[1] };
  20. a2 = new GameObject[] { g[3], g[4], g[5] };
  21. meshBaker.AddDeleteGameObjects(a2, d1, true);
  22. meshBaker.Apply();
  23. meshBaker.meshCombiner.CheckIntegrity();
  24. yield return new WaitForSeconds(3f);
  25. Debug.Log("Test 3 remove 0,2,5 and add 1");
  26. d1 = new GameObject[] { g[3], g[4], g[5] };
  27. a2 = new GameObject[] { g[1] };
  28. meshBaker.AddDeleteGameObjects(a2, d1, true);
  29. meshBaker.Apply();
  30. meshBaker.meshCombiner.CheckIntegrity();
  31. yield return new WaitForSeconds(3f);
  32. Debug.Log("Test 3 remove all remaining");
  33. d1 = new GameObject[] { g[0], g[1], g[2] };
  34. meshBaker.AddDeleteGameObjects(null, d1, true);
  35. meshBaker.Apply();
  36. meshBaker.meshCombiner.CheckIntegrity();
  37. yield return new WaitForSeconds(3f);
  38. Debug.Log("Test 3 add all");
  39. meshBaker.AddDeleteGameObjects(g, null, true);
  40. meshBaker.Apply();
  41. meshBaker.meshCombiner.CheckIntegrity();
  42. yield return new WaitForSeconds(1f);
  43. Debug.Log("Done");
  44. }
  45. }