Start and Awake running twice?

I’m somewhat new to Unity and scripting in C#. I have a script attached to a gameobject, and set a value in the start function. However, the start function seems to be running twice. I’ve double checked that I only have 1 instance of the script attached to the object, and I’ve tried removing the script from the gameobject and re-adding it, to no avail. I have also tried running the code in the awake function, but that also runs twice.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class destroyOnHit : MonoBehaviour
{
    public GameObject explosion;
    // Start is called before the first frame update

    public bool destroy;
    private void Awake()
    {

        Debug.Log("awake");
    }
    void Start()
    {
        Debug.Log("Framecount: "+Time.frameCount);
        Debug.Log("Start: "+destroy + ", "+gameObject.transform.position.ToString());

    }

    // Update is called once per frame
    void Update()
    {
        
    }
    private void OnCollisionEnter(Collision collision)
    {
        
        if(collision.gameObject.tag == "Bullet")
        {

            Debug.Log("hit");
            Debug.Log(destroy + ", " + gameObject.transform.position.ToString());

            Instantiate(explosion, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
            if (destroy)
            {
                Destroy(transform.parent.gameObject);
                Debug.Log("destroyed");

            }
            else
            {
                transform.parent.gameObject.SetActive(false);
                Debug.Log("set inactive");

            }
        }
    }
}

bool Once = false;

    private void Awake()
    {
        if (Once == false)
        {
            //Do Action
            Once = true; 
        }
    }

Adding this little snippet will only allow whatever is in the awake to run once. However, you do need to check if any other scripts or functions are calling the same start or awake methods more than once because this shouldnt be happening

I ran into the same problem today but found my error. In the script which instatiated the gameobject I later wanted to also set the instance to a gameobject so I could set the parent but forgot to comment out the initial instantiation.

Somehow this created an unvisible duplicate. The whole script ran twice, Llama_w_2Ls code didn’t work but there was only one gameobject visible underneath the parent and on transform.name both times the code ran, the name was gameObject(Clone).

I tried to set a debug for transform.parent.name and 1 returned a nullrefference.

No solution here but I hope it helps with debugging.