*
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class Plot3DUpdater : MonoBehaviour {
|
||||
public Plot3D target;
|
||||
public bool on_update;
|
||||
public bool on_editor_update;
|
||||
public bool on_fixedUpdate;
|
||||
|
||||
public int on_frame = 1;
|
||||
|
||||
private int frame = 0;
|
||||
|
||||
void Start()
|
||||
{
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
void DoUpdate(bool skip_frame = true) {
|
||||
if (on_frame < 1){
|
||||
on_frame = 1;
|
||||
}
|
||||
|
||||
|
||||
if (!skip_frame || (frame%on_frame) == 0){
|
||||
if (target != null) {
|
||||
target.UpdateMesh();
|
||||
}
|
||||
}
|
||||
|
||||
frame++;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (on_update) {
|
||||
DoUpdate();
|
||||
}else if (on_editor_update && !Application.isPlaying)
|
||||
{
|
||||
DoUpdate(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
if (on_fixedUpdate) {
|
||||
DoUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user