Version: 2020.3
public bool allowRoll ;

描述

允许公告牌粒子绕其 z 轴滚动。

允许公告牌随摄像机一起滚动。使用 VR 时禁用此选项通常很有用,可以让粒子在世界中的着地更加可信。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {

private ParticleSystemRenderer psr; public bool allowRoll = true;

void Start() { psr = GetComponent<ParticleSystemRenderer>(); psr.material = new Material(Shader.Find("Sprites/Default")); }

void Update() { var psr = GetComponent<ParticleSystemRenderer>(); psr.allowRoll = allowRoll;

Camera.main.transform.rotation = Quaternion.Euler(0.0f, 0.0f, Mathf.Sin(Time.time * 0.2f) * 90.0f); }

void OnGUI() { allowRoll = GUI.Toggle(new Rect(25, 45, 200, 30), allowRoll, "Allow Roll"); } }