You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
930 B

using UnityEngine;
public class RunTimeCombineAndRelease:MonoBehaviour{
public SimpleMeshCombine simpleMeshCombine;
public float combineTime = 0.5f;
public float releaseTime = 2.0f;
public void Awake(){
simpleMeshCombine = GetComponent<SimpleMeshCombine>();
//simpleMeshCombine.CombineMeshes();
}
public void Start() {
if(simpleMeshCombine == null){
Debug.Log("Couldn't find SMC, aborting");
return;
}
Invoke("Combine", combineTime);
Invoke("Release", releaseTime);
}
public void Combine() {
simpleMeshCombine.CombineMeshes();
Debug.Log("Combined");
}
public void Release() {
simpleMeshCombine.EnableRenderers(true);
if(simpleMeshCombine.combined == null) return;
Destroy(simpleMeshCombine.combined);
simpleMeshCombine.combinedGameOjects = null;
Debug.Log("Released");
}
}