版本: Unity 6 (6000.0)
语言英语
  • C#

ParticleSystem.TrailModule.splitSubEmitterRibbons

建议更改

成功!

感谢您帮助我们提高 Unity 文档的质量。虽然我们不能接受所有提交内容,但我们确实会阅读用户提出的每项更改建议,并在适用的情况下进行更新。

关闭

提交失败

由于某种原因,您的更改建议无法提交。请<a>稍后再试</a>。感谢您抽出时间帮助我们提高 Unity 文档的质量。

关闭

取消

切换到手册
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"); } }