반응형
유니티에서 파티클 시스템 오브젝트를 소환하면 기본적으로 위와 같이 몇몇 이펙트를 뿌려주는 것이 기본 세팅입니다.
근데 제작하는 이펙트중 Emission을 1개만 사용하는 이펙트를 사용할때가 종종 있는데, 이 세팅을 간단히 해주는 스크립트입니다.
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class ParticleSystemAutoReset : EditorWindow
{
[MenuItem("CONTEXT/ParticleSystem/Set Single Particle")]
public static void SetSingleParticle(MenuCommand cmd)
{
ParticleSystem particle = cmd.context as ParticleSystem;
if (particle != null)
{
{
var setParticle = particle.main;
setParticle.startSpeed = 0;
}
{
var setParticle = particle.emission;
setParticle.enabled = true;
setParticle.rateOverTime = 0.0f;
setParticle.burstCount = 1;
setParticle.SetBurst(0, new ParticleSystem.Burst(0.0f, 1, 1, 0.01f));
}
{
var setParticle = particle.shape;
setParticle.enabled = false;
}
}
}
}
#endif
해당 스크립트를 유니티에 생성하고
파티클 시스템 오브젝트에서 위 사진같이 Set Single Particle를 누르면 자동으로 제자리에서 1개만 파티클 생성하게 세팅됩니다.
반응형
'Unity > Programming' 카테고리의 다른 글
Script 에셋 경로 참조하기 (0) | 2023.04.04 |
---|---|
Unity URP HLSL 쉐이더 템플릿 생성 스크립트 (0) | 2023.03.07 |
[Unity Editor] Assetdatabase - 에디터 단위 에셋관리 (0) | 2020.05.25 |
[Unity Editor] Editor Window (2) | 2020.05.24 |
[Unity Editor] MenuItem 종류 (1) | 2020.05.24 |
WRITTEN BY
- CatDarkGame
Technical Artist dhwlgn12@gmail.com
,