Q:

How do I make the 2D collider not do any function to already colliding objects before level start

In my level, I have a water collider where if you fall in, it triggers a splash effect and water sounds. However, because there is already an object inside the water, whenever I start the level, the water collider triggers and splash and water sounds despite the object already being in the collider.
So, even with the object deep inside the water collider, it creates the splash sound and water effect as if it just fell in.
How do I prevent this?
My code involves OnTrigger2D functions. But how do I make Unity check if an object is already colliding before level load?
Code:
private void OnTriggerEnter2D(Collider2D other)
{
    if (other.tag == "Player")
    {
            gravityoriginal = playerrigidbody.gravityScale;
        massoriginal = playerrigidbody.mass;
            playerrigidbody.gravityScale = 0.1f;
            playerrigidbody.mass = other.GetComponent<Rigidbody2D>().mass + 2f;
            splash.Play(); //Plays the initial splash if velocity is high
            underwaterbool.IsUnderwater = true; //stop dust particle
            mainmusic.enabled = true;
            powerupmusic.enabled = true;
            deathmusic.enabled = true;
    }
    else if (other.tag == "Snatcher")
    {
        masssnatcheroriginal = snatcherrigidbody.mass;
            gravityoriginalsnatcher = snatcherrigidbody.gravityScale;
            snatcherrigidbody.gravityScale = 0.1f;
            snatcherrigidbody.mass = other.GetComponent<Rigidbody2D>().mass + 2f;
            splashsnatcher.Play();
            snatchersounds.enabled = true;
    }
    else if (other.tag != "Player" && other.tag != "Snatcher" && other.GetComponent<Rigidbody2D>() != null)
    {
            gravityoriginalbox = other.GetComponent<Rigidbody2D>().gravityScale;
            massoriginalbox = other.GetComponent<Rigidbody2D>().mass;
            other.GetComponent<Rigidbody2D>().mass = other.GetComponent<Rigidbody2D>().mass + 2f;
            other.GetComponent<Rigidbody2D>().gravityScale = 0.1f;
            other.GetComponent<ParticleSystem>().Play(false);
            splashaudio.Play();
            Splashparticlesforbox.IsUnderwaterBox = true;
    }
    if(other.GetComponent<Rigidbody2D>() != null)
    {
        other.GetComponent<Rigidbody2D>().velocity = new Vector2(0f, -0.5f);
    }
    if (!cooldown)
    {
        splashaudio.Play();
    }
    cooldown = true;
    StartCoroutine(waittime());
}

A:

Can you post your OnTrigger2D functions code please? Normally Unity does not trigger the OnTriggerEnter method if an object is already inside the trigger when the scene beggins but the OnTriggerStay is executed every frame.
Anyway... one option (not the best one I think) would be to put a boolean propoerty in the trigger that is initialized true and use it to prevent the OnTriggerFunctions to do anything til the fame ends. Then in the LateUpdate method you can set the property as false.
bool m_FirstFrame = true;

void onEnable()
{
   m_FirstFrame = true;
}

void OnTriggerEnter2D(Collider2D collision)
{
        if(m_FirstFrame){
            return;
        }
        .... //Rest of code
}

//Same for the other OnTrigger2D methods you use

void LateUpdate()
{
   m_FirstFrame = false;
}

I hope it helps! Tell me if you need something more, and please, post your code, that way is easier for us to fint where is the issue and get how to fix it.
Good luck ^^

