Unity2019_Special effects system

 

 Duration, whether to loop, simulation space (local coordinates, world coordinates, custom), local coordinates special effect movement, the generated particles will follow the movement, world coordinates are special effects movement, and the generated particles will not follow the movement.

 

using UnityEngine;

public class ParticleText : MonoBehaviour
{
    GameObject particleGo;
    ParticleSystem particle;
    void Start()
    {
        particleGo = GameObject.Instantiate(Resources.Load<GameObject>("22_RFX_Fire_Campfire1"));
        particleGo.transform.position = transform.position;
        particle = particleGo.GetComponent<ParticleSystem>();
        // 主模块
        ParticleSystem.MainModule mainModule = particle.main;
        mainModule.loop = true;
    }
    void Update()
    {
		if (Input.GetKeyDown("a"))
		{
            particle.Play();
		}
        if (Input.GetKeyDown("b"))
        {
            particle.Stop();
        }
        if (Input.GetKeyDown("c"))
        {
            particle.Pause();
        }
        if (Input.GetKeyDown("c"))
        {
            Destroy(particleGo);
        }
    }

    /// <summary>
    /// 碰撞函数的回调
    /// </summary>
    /// <param name="other"></param>
	private void OnParticleCollision(GameObject other)
	{
        Debug.LogError("粒子碰撞到的物体:     " + other.name);
	}
}

 Detecting particle collisions needs to be checked

The collision script is attached to the object with texture

 Check

 

 

Guess you like

Origin blog.csdn.net/qq_35647121/article/details/126688757