"If you do nothing, nothing will happen."

프로그래밍

[Unity3D] TimeScale 의 영향을 받지 않는 particale

tedhong 2023. 2. 9. 14:23
2014-10-27 글쓴이 TED HONG

[Unity3D] TimeScale 의 영향을 받지 않는 particale

파티클은 유니티 엔진에서 컨트롤을 하기 때문에

TimeScale 이 0인 경우에는 동작하지 않는다.

이를 해결 하려면 다음 스크립트를 파티클 오브젝트에 추가한다.

 

 

using UnityEngine;
using System.Collections;

public class ParticaleAnimator : MonoBehaviour
{

    private void Awake()
    {
        particle = GetComponent<ParticleSystem>();
    }

    // Use this for initialization
    void Start()
    {
        lastTime = Time.realtimeSinceStartup;
    }

    // Update is called once per frame
    void Update()
    {

        float deltaTime = Time.realtimeSinceStartup - (float)lastTime;

        particle.Simulate(deltaTime, true, false); //last must be false!!

        lastTime = Time.realtimeSinceStartup;
    }

    private double lastTime;
    private ParticleSystem particle;

}

'프로그래밍' 카테고리의 다른 글

[Unity3D] RaycastHit2D  (0) 2023.02.09
2DToolkit 에서 Spine애니메이션 가져오기  (0) 2023.02.09
[VS2013] CRLF/ LF 개행문자 자동 변환  (0) 2023.02.09
Android – BLE Scan Example  (0) 2023.02.09
Bluetooth Low Energy  (0) 2023.02.09