I finished creating the particles, I configured it so that if the enemy dies the particles appear and then these particles will be destroyed. But when it is going to be destroyed the following error appears:
Destroying assets is not permitted to avoid data loss.
If you really want to remove an asset use DestroyImmediate(theObject, true);
UnityEngine.Object: Destroy (UnityEngine.Object)
Ammo2:OnTriggerEnter2D (UnityEngine.Collider2D) (at Assets/Scripts/Ammo2.cs:26)
What could I do to fix this error?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Munição2 : MonoBehaviour
{
public ParticleSystem Explosao_Tiro1;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter2D(Collider2D outro)
{
if(outro.gameObject.CompareTag("Parede"))
{
Instantiate(Explosao_Tiro1, transform.position, Quaternion.identity);
Destroy(gameObject);
Destroy(Explosao_Tiro1);
}
}
}