Silly question - Adding to a class (GameObject)?

Is it possible to create my own custom functions in GameObject (or even Mathf)? Like if I wanted to do something like GameObject.GetChildrenObjects(gameObject) and it would do as it suggests, is that possible to add something like that? Or would I need to just get over it?

You cannot extend a class (afar) with static methods like you want to but you can use extension methods to extend … ok this is confusing let’s have an example:

public static class ExtensionClass{
    public static void PrintGameObjectName(this GameObject obj){
        Debug.Log(obj.name);
    }
    public GameObject[] GetChildrenObject(this GameObject obj, bool active){
         List<Transform>list = new List<Transform>();
         foreach(Transform t in obj.transform){
             if(active && t.gameObject.activeInHierarchy){
                  list.Add(t.gameObject);
             }
             else{list.Add(t.gameObject);}
         }
         return list.ToArray();
    }
} 

And you use those as:

gameObject.PrintGameObjectName();
GameObject[] children = gameObject.GetChildrenObjects(true);

P.S. I am not sure the transform iteration returns the inactive children but that was more for the sake of demonstrating the possibility to use parameters.

Sure. Using an extension method.