ParticleSystemRenderer.flip

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public Vector3 flip;

Description

Flip a percentage of the particles, along each axis.

Set between 0 and 1, where higher values cause a higher proportion of the particles to be flipped, and 1 causes all particles to be flipped.

using UnityEngine;
using UnityEditor;
using System.Collections;

public class ExampleClass : MonoBehaviour {

private ParticleSystemRenderer psr; public Vector3 flip;

void Start() {

psr = GetComponent<ParticleSystemRenderer>();

psr.material = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat"); // square material so we can see the pivot more easily psr.mesh = Resources.GetBuiltinResource<Mesh>("Capsule.fbx"); }

void Update() {

psr.flip = flip; }

void OnGUI() {

GUI.Label(new Rect(25, 40, 100, 30), "X"); GUI.Label(new Rect(25, 80, 100, 30), "Y"); GUI.Label(new Rect(25, 120, 100, 30), "Z");

flip.x = GUI.HorizontalSlider(new Rect(65, 25, 100, 30), flip.x, 0.0f, 1.0f); flip.y = GUI.HorizontalSlider(new Rect(65, 65, 100, 30), flip.y, 0.0f, 1.0f); flip.z = GUI.HorizontalSlider(new Rect(65, 105, 100, 30), flip.z, 0.0f, 1.0f); } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答