Object reference error when adding script runtime

Hello, when script (weaponFists) containing class derived from BaseWeaponMelee is added to player at runtime it throws error:

NullReferenceException: Object reference not set to an instance of an object
weaponFists.Start () (at Assets/Content/playerClasses/mateusz/weapons/Resources/fists/weaponFists.cs:26)

If weaponFists is in player before starting game it works fine without any issues

Base class BaseWeaponMelee:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
using UnityEngine.Audio;

public class BaseWeaponMelee : NetworkBehaviour
{
    public string weaponName;

    public float PrimaryDamage, randomDamageMultiplier, hitRadius = .5f, hitDistance = 2.5f;

    float weaponCondition;

    public bool staticDamage, secAttSplitAnims = false, throwable = true, heavySwing = false;

    bool attackReady = true, secondaryAttackReady = false, equipped = false;

    public Camera playerCamera;

    public GameObject weaponModel, vWeaponModel, activeWeapon, vActiveWeapon;

    public WeaponTransform weaponModelTransform, vWeaponModelTransform;

    public AnimClipNameLenght vAnimEquip, animEquip, vAnimIdle, animIdle;
 
    public List<AnimClipNameLenght> vAnimsPrimaryAttack, animsPrimaryAttack, vAnimsSecondaryAttack, animsSecondaryAttack;

    public List<AudioClip> attackSoundClips;

    public playerController playerController;

    public playerSounds playerSounds;

    public playerInventory playerInventory;

    [System.Serializable]
    public struct WeaponTransform
    {
        Vector3 position, scale;
        Quaternion rotation;

        public WeaponTransform(Vector3 pos, Vector3 scalee, Quaternion rot)
        {
            position = pos;
            scale = scalee;
            rotation = rot;
        }
    }

    [System.Serializable]
    public struct AnimClipNameLenght
    {
        public float yieldBefore;
        public float yieldAfter;
        public string name;

        public AnimClipNameLenght(string na, float yb, float ya)
        {
            name = na;
            yieldAfter = ya;
            yieldBefore = yb;
        }
    }

    public void baseStart()
    {
       
        playerInventory = GetComponent<playerInventory>();
        playerController = GetComponent<playerController>();
        playerSounds = GetComponent<playerSounds>();
        playerCamera = playerController.playerCamera;

        if (playerInventory.tempWeaponCond == 0)
        {
            weaponCondition = playerInventory.tempWeaponCond;
            playerInventory.tempWeaponCond = 0;
        }
            

        //weaponModel = (GameObject)Resources.Load("axe/weaponAxe");
        
    }

    private void Update()
    {
        weapon();
    }

    void swingSound(float delay = 0)
    {
        if (!weaponModel)
            return;

        if (!heavySwing)
            playerSounds.swing(delay);
        else
            playerSounds.heavyWeaponSwing(delay);
    }

    public void weapon()
    {
        if (!isLocalPlayer || playerController.isInCar || !playerController.isMovementOn || !equipped)
            return;

        secondaryAttack();

        if (!attackReady)
            return;

        primaryAttack();

        if(throwable)
            throwWeapon();
    }

    public IEnumerator equipWeapon()
    {
        if (weaponModel)
        {
            GameObject vActiveItem = Instantiate(weaponModel, playerController.vHand.position, playerController.vHand.rotation);
            vActiveWeapon = vActiveItem;
            vActiveItem.transform.parent = playerController.vHand.transform;
            vActiveItem.transform.localPosition = new Vector3(0.00101f, 0.00337f, 0.00782f);
            vActiveItem.transform.localRotation = Quaternion.Euler(-14.237f, -0.867f, 89.017f);
            vActiveItem.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
        }
        playerController.arms.SetActive(true);
        playerController.vAnimator.Play(vAnimEquip.name);
        playerController.playerAnimator.Play(animEquip.name, 2);
        yield return new WaitForSeconds(vAnimEquip.yieldBefore);
        playerController.vAnimator.Play(vAnimIdle.name);
        playerController.playerAnimator.Play(animIdle.name, 2);
        equipped = true;
    }

    void targetHit()
    {
        RaycastHit[] hit = Physics.SphereCastAll(playerCamera.transform.position, hitRadius, playerCamera.transform.forward, hitDistance, ~LayerMask.GetMask("Player"), QueryTriggerInteraction.Ignore);

        if (hit.Length < 1)
            return;
        //Debug.Log(raycast.collider.transform.root.gameObject);
        bool takeDamageFound = false;
        foreach(RaycastHit raycast in hit)
        {
            if (raycast.collider.transform.root.GetComponent<TakeDamage>())
            {
                takeDamageFound = true;
                var takeDamage = raycast.collider.transform.root.GetComponent<TakeDamage>();
                playRandSound(attackSoundClips);
                float randDmg = randomDamageAmount(PrimaryDamage);

                if (staticDamage)
                {
                    takeDamage.TakeDamageFunctionCmd(PrimaryDamage, raycast.point);
                    GameObject go = Instantiate(playerController.bloodImpactBig, hit[0].point, Quaternion.LookRotation(raycast.normal));
                    Destroy(go, 5f);
                }
                else
                {
                    takeDamage.TakeDamageFunctionCmd(randDmg, raycast.point);
                    GameObject go = Instantiate(correctBloodFX(randDmg), raycast.point, Quaternion.LookRotation(raycast.normal));
                    Destroy(go, 5f);
                }
            }            
        }

        if (!takeDamageFound && hit[0].collider.transform.root.gameObject.layer != 2)
        {
            playerController.GetComponent<hurtGeneric>().funcHurtGeneric();

            if (hit[0].collider.transform.root.gameObject.GetComponent<Rigidbody>())
            {
                Rigidbody hitRigibody = hit[0].collider.transform.root.gameObject.GetComponent<Rigidbody>();
                hitRigibody.AddForce(playerCamera.transform.forward * 5, ForceMode.Impulse);
            }

            GameObject go = Instantiate(playerController.genericImpact, hit[0].point, Quaternion.LookRotation(hit[0].normal));
            Destroy(go, 5f);
        }



    }

    public void secondaryAttack()
    {     
        StartCoroutine(enumerator());
        IEnumerator enumerator()
        {
            if (Input.GetKey(KeyCode.Mouse1) && !secondaryAttackReady)
            {               
                attackReady = false;
                playerController.vAnimator.Play(vAnimsSecondaryAttack[0].name);

                if(secAttSplitAnims)
                    playerController.playerAnimator.Play(animsSecondaryAttack[0].name);

                yield return new WaitForSeconds(vAnimsSecondaryAttack[0].yieldBefore);

                if(Input.GetKey(KeyCode.Mouse1))
                    secondaryAttackReady = true;

            }
            else if (Input.GetKeyUp(KeyCode.Mouse1))
            {
                if (secondaryAttackReady)
                {
                    swingSound();
                    playerController.vAnimator.Play(vAnimsSecondaryAttack[1].name);

                    if(secAttSplitAnims)
                        playerController.playerAnimator.Play(animsSecondaryAttack[1].name);
                    else
                        playerController.playerAnimator.Play(animsSecondaryAttack[0].name);

                    yield return new WaitForSeconds(vAnimsSecondaryAttack[1].yieldBefore);
                    targetHit();
                    yield return new WaitForSeconds(vAnimsSecondaryAttack[1].yieldAfter);
                    playerController.vAnimator.Play(vAnimIdle.name);
                    playerController.playerAnimator.Play(animIdle.name, 2);
                    attackReady = true;
                    secondaryAttackReady = false;
                }
                else
                {
                    playerController.vAnimator.Play(vAnimIdle.name);
                    playerController.playerAnimator.Play(animIdle.name, 2);
                    attackReady = true;
                    
                }
            }
        
        }
       
    }

    public void primaryAttack()
    {
        StartCoroutine(enumerator());
        IEnumerator enumerator()
        {
            if (Input.GetKey(KeyCode.Mouse0))
            {
                swingSound();

                attackReady = false;
                playRandAnimation(vAnimsPrimaryAttack, playerController.vAnimator);
                playRandAnimation(animsPrimaryAttack, playerController.playerAnimator, 2);
                yield return new WaitForSeconds(vAnimsPrimaryAttack[0].yieldBefore);
                targetHit();

                yield return new WaitForSeconds(vAnimsPrimaryAttack[0].yieldAfter);
                playerController.vAnimator.Play(vAnimIdle.name);
                playerController.playerAnimator.Play(animIdle.name, 2);
                attackReady = true;

            }


        }

    }

    public void throwWeapon()
    {       
        if (Input.GetKeyDown(KeyCode.Mouse2))
        {
            swingSound();
            GameObject go = Instantiate(weaponModel, playerController.throwTransform.position, Quaternion.Euler(Vector3.zero));
            go.AddComponent(typeof(NetworkIdentity));
            go.AddComponent(typeof(throwWeapon));
            go.AddComponent(typeof(Rigidbody));
            go.AddComponent(typeof(BoxCollider));
            go.AddComponent(typeof(EntityWeapon));
            var entWeapon = go.GetComponent<EntityWeapon>();
            entWeapon.weapon = weaponName;
            entWeapon.weapon = weaponName;
            go.GetComponent<Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Continuous; 
            go.layer = 0;
            go.tag = "weapon";


            NetworkServer.Spawn(go);
            
            
            throwWeapon throwweapon = go.GetComponent<throwWeapon>();
            throwweapon.cond = weaponCondition;
            throwweapon.damage = PrimaryDamage;
            throwweapon.playerIdentity = netIdentity;
            go.GetComponent<Rigidbody>().freezeRotation = false;
            if (isServer)
            {
                addForceWeaponCmd(go.GetComponent<NetworkIdentity>());
            }

            deleteWeapon();
        }
        
    }

    void holsterWeapon()
    {
        playerController.playerAnimator.Play("playerRig|idle", 2);
        playerController.vAnimator.Play("armsRig|idle");
    }

    void deleteWeapon()
    {
        holsterWeapon();
        Destroy(this);
    }

    [Command(requiresAuthority = false)]
    private void addForceWeaponCmd(NetworkIdentity identity)
    {
        Rigidbody rb = identity.GetComponent<Rigidbody>();
        rb.AddForce(playerCamera.transform.forward * 25, ForceMode.VelocityChange);
        rb.AddForce(transform.up * 5f, ForceMode.Impulse);
        rb.AddTorque(transform.forward * 100f, ForceMode.Impulse);
    }

    void playRandSound(List<AudioClip> clips)
    {
        int index = clips.Count;
        int rand = Random.Range(0, index--);
        playerController.movementAudioSource.PlayOneShot(clips[rand]);
    }

    void playRandAnimation(List<AnimClipNameLenght> clips, Animator animator, int layer = 0)
    {
        int index = clips.Count;
        int rand = Random.Range(0, index--);
        animator.Play(clips[rand].name, layer);
    }

    float randomDamageAmount(float dmg)
    {       
        dmg *= Random.Range(1, randomDamageMultiplier);
        return dmg;       
    }

    GameObject correctBloodFX(float dmg)
    {
        float maxDmg = PrimaryDamage * randomDamageMultiplier;
        float value = (dmg * 100) / maxDmg;

        if(value < 55)
            return playerController.bloodImpactSmall;
        else if(value < 80)
            return playerController.bloodImpactMedium;
        else
            return playerController.bloodImpactBig;

    }


}

derived class weaponFists:

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

public class weaponFists : BaseWeaponMelee
{

    public void Start()
    {
        baseStart();

        
        PrimaryDamage = 5;
        randomDamageMultiplier = 3;
        secAttSplitAnims = true;
        throwable = false;

        vAnimEquip.name = "armsRig|fistIdle";
        vAnimIdle.name = "armsRig|fistIdleLoop";
        vAnimEquip.yieldBefore = 1.6f;

        animIdle.name = "playerRig|fistIdle";
        animEquip.name = "playerRig|fistOpen";
        

        vAnimsPrimaryAttack.Add(new AnimClipNameLenght("armsRig|punch01", 0.1f, .525f));
        vAnimsPrimaryAttack.Add(new AnimClipNameLenght("armsRig|punch02", 0.1f, .525f));
        vAnimsPrimaryAttack.Add(new AnimClipNameLenght("armsRig|punch03", 0.1f, .525f));
        vAnimsPrimaryAttack.Add(new AnimClipNameLenght("armsRig|punch04", 0.1f, .525f));
      
        animsPrimaryAttack.Add(new AnimClipNameLenght("playerRig|punch01", 0, 0));
        animsPrimaryAttack.Add(new AnimClipNameLenght("playerRig|punch02", 0, 0));


        vAnimsSecondaryAttack.Add(new AnimClipNameLenght("armsRig|punch05a", 0.417f, 0));
        vAnimsSecondaryAttack.Add(new AnimClipNameLenght("armsRig|punch05", 0.08f, 1.16f));

        animsSecondaryAttack.Add (new AnimClipNameLenght("playerRig|punch0a", 0, 0));
        animsSecondaryAttack.Add (new AnimClipNameLenght("playerRig|punch0b", 0, 0));

        var hurtGeneric = GetComponent<hurtGeneric>();
        attackSoundClips.Add(hurtGeneric.hurt01);
        attackSoundClips.Add(hurtGeneric.hurt02);
        attackSoundClips.Add(hurtGeneric.hurt03);
        attackSoundClips.Add(hurtGeneric.hurt04);
    }

    private void Update()
    {
        //weapon();

        if (Input.GetKeyDown(KeyCode.K))
            StartCoroutine(equipWeapon());
    }

}

Your lists are not set to a default value.

Try initializing them at the beginning of the Start() method, with:

vAnimsPrimaryAttack = new List<AnimClipNameLenght>();
animsPrimaryAttack = new List<AnimClipNameLenght>();
vAnimsSecondaryAttack = new List<AnimClipNameLenght>();
animsSecondaryAttack = new List<AnimClipNameLenght>();

The reason your scripts worked as you expected when giving the component before entering Play mode is (if I’m not mistaken) that Unity initializes the nullable fields that are serializable (meaning displayed in the inspector) to their default value when the game starts.

This can be convenient sometimes but doesn’t happen in Play mode, which is why your error occurred.