Version: 2021.3
public float normalDirection ;

描述

指定公告牌粒子使其法线朝向摄像机的程度。

将其设置为 0 可球体化公告牌法线。将其设置为 1 可使法线指向摄像机。

using UnityEngine;
using UnityEditor;
using System.Collections;

[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour {

private ParticleSystem ps; private ParticleSystemRenderer psr; public float normalDirection = 1.0f;

void Start() {

ps = GetComponent<ParticleSystem>(); psr = GetComponent<ParticleSystemRenderer>();

psr.material = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat"); }

void Update() {

psr.normalDirection = normalDirection; }

void OnGUI() {

normalDirection = GUI.HorizontalSlider(new Rect(25, 25, 100, 30), normalDirection, 0.0f, 1.0f); } }