Version: 2021.3
public Transform customSimulationSpace ;

描述

模拟相对于自定义变换组件的粒子。

using System.Collections;
using UnityEngine;

[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour { private ParticleSystem ps; public Transform relativeTo;

void Start() { ps = GetComponent<ParticleSystem>();

var main = ps.main; main.simulationSpace = ParticleSystemSimulationSpace.Custom; main.customSimulationSpace = relativeTo; } }