MB3_TestBakeAllWithSameMaterial.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using UnityEngine;
  2. using System.Collections;
  3. using DigitalOpus.MB.Core;
  4. public class MB3_TestBakeAllWithSameMaterial : MonoBehaviour {
  5. public GameObject[] listOfObjsToCombineGood;
  6. public GameObject[] listOfObjsToCombineBad;
  7. // Use this for initialization
  8. void Start () {
  9. testCombine();
  10. }
  11. void testCombine(){
  12. MB3_MeshCombinerSingle mb = new MB3_MeshCombinerSingle();
  13. Debug.Log ("About to bake 1");
  14. mb.AddDeleteGameObjects(listOfObjsToCombineGood,null);
  15. mb.Apply();
  16. mb.UpdateGameObjects(listOfObjsToCombineGood);
  17. mb.Apply ();
  18. mb.AddDeleteGameObjects(null,listOfObjsToCombineGood);
  19. mb.Apply ();
  20. Debug.Log ("Did bake 1");
  21. Debug.Log ("About to bake 2 should get error that one material doesn't match");
  22. mb.AddDeleteGameObjects(listOfObjsToCombineBad,null);
  23. mb.Apply();
  24. Debug.Log ("Did bake 2");
  25. Debug.Log("Doing same with multi mesh combiner");
  26. MB3_MultiMeshCombiner mmb = new MB3_MultiMeshCombiner();
  27. Debug.Log ("About to bake 3");
  28. mmb.AddDeleteGameObjects(listOfObjsToCombineGood,null);
  29. mmb.Apply();
  30. mmb.UpdateGameObjects(listOfObjsToCombineGood);
  31. mmb.Apply ();
  32. mmb.AddDeleteGameObjects(null,listOfObjsToCombineGood);
  33. mmb.Apply ();
  34. Debug.Log ("Did bake 3");
  35. Debug.Log ("About to bake 4 should get error that one material doesn't match");
  36. mmb.AddDeleteGameObjects(listOfObjsToCombineBad,null);
  37. mmb.Apply();
  38. Debug.Log ("Did bake 4");
  39. }
  40. }