Version: 2022.1
public bool splitSubEmitterRibbons ;

描述

指定在使用此系统作为子发射器时,轨迹带是否独立地连接来自每个父粒子的粒子。

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour { private ParticleSystem ps; private ParticleSystem sps; public bool splitSubEmitterRibbons = true;

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

var main = ps.main; main.startColor = new ParticleSystem.MinMaxGradient(Color.red, Color.yellow); main.startSize = new ParticleSystem.MinMaxCurve(0.01f, 1.0f); main.startLifetime = 1.5f;

sps = new GameObject("SubEmitter", typeof(ParticleSystem)).GetComponent<ParticleSystem>(); sps.transform.parent = ps.transform;

var sub = ps.subEmitters; sub.enabled = true; sub.AddSubEmitter(sps, ParticleSystemSubEmitterType.Birth, ParticleSystemSubEmitterProperties.InheritColor);

var smain = sps.main; smain.startSpeed = 0.0f;

var sshape = sps.shape; sshape.enabled = false;

var strails = sps.trails; strails.enabled = true; strails.mode = ParticleSystemTrailMode.Ribbon; strails.widthOverTrail = 0.1f;

var spsr = sps.GetComponent<ParticleSystemRenderer>(); spsr.renderMode = ParticleSystemRenderMode.None; spsr.trailMaterial = new Material(Shader.Find("Sprites/Default")); }

void Update() { var strails = sps.trails; strails.splitSubEmitterRibbons = splitSubEmitterRibbons; }

void OnGUI() { splitSubEmitterRibbons = GUI.Toggle(new Rect(25, 25, 200, 30), splitSubEmitterRibbons, "Split Sub Emitter Ribbons"); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961