本项目以Morgan为中心,处理这个角色需要将 VFX Graph 的功能发挥到极致。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

60 行
1.2 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;
[ExecuteAlways]
[ExecuteInEditMode]
public class VFXGraph_SetPlayRate : MonoBehaviour
{
[SerializeField]
public float playRate = 1;
[SerializeField]
public bool reinitOnEnabled = true;
[SerializeField]
public bool limitFPS = false;
[SerializeField]
public int fps = 30;
public VisualEffect vf;
// Start is called before the first frame update
void Start()
{
//vf = GetComponent<VisualEffect>();
}
// Update is called once per frame
void Update()
{
if (isActiveAndEnabled) vf.playRate = playRate;
}
void Awake()
{
#if UNITY_EDITOR
int originalvSyncCount = QualitySettings.vSyncCount;
int originalTargetFrameRate = Application.targetFrameRate;
if (limitFPS)
{
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = fps;
}
else
{
QualitySettings.vSyncCount = originalvSyncCount;
Application.targetFrameRate = originalTargetFrameRate;
}
#endif
}
void OnEnable()
{
if (reinitOnEnabled) vf.Reinit();
}
}