Version: 2020.3
言語: 日本語
public bool splitSubEmitterRibbons ;

説明

Specifies whether, if you use this system as a sub-emitter, ribbons connect particles from each parent particle independently.

using UnityEngine;
using System.Collections;

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