Files
2025-05-13 03:19:28 +03:00

52 lines
921 B
C#

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();
}
}
}