Creating a class at run time and accessing it, best practice?

Hello, I am creating an object class for a weapon system at runtime and I want to be able to call a method like “Shoot” from outside on a player class. How could I call ShootObject without adding it as a component?
Would I have to attach the Object manager to it’s created object in order to call ‘ShootObject()’ method? Is this the best way to do this? I was under the assumption when you created an object it came with all it’s methods and properties:

 >ObjectManager.cs
    public void CreateNewObject()
    {
        ObjectClass newObject = new ObjectClass();
    }

  >Objectclass.cs
    public ObjectClass()
     {
          GameObject newGameObject = new GameObject();
          
          newGameObject.AddComponent <ObjectClass>();
          //DO I DO THIS? ^
     }

     public void ShootObject()
     {
          //blah
     }

 >PlayerClass.cs
    void UseObject()
    {
        ObjectClass oc = currentHoldingGameObject.GetComponent<ObjectClass>();
        oc.ShootObject(); //Null refrence
    }

thanks,

something must be calling your ObjectClass constructor, otherwise you wouldn’t get an instance of it.whoever does that should create the gameobject instead of your constructor and just AddComponent(). I’d even think you’d probably run into a problem with your approach, if not Unity complains about an existing constructor. But since the class adds a new instance in its own constructor to a newly created gameobject, the constructor for the new instance is called again and again creates gameobject and instance, causing an infinite loop, if I’m not mistaken.