/// <summary> /// A function which will be used to add a child and sets it's parent to this /// </summary> /// <typeparam name="K">The type of the child</typeparam> /// <param name="childToAdd">The child itself</param> /// <param name="load">A flag to indicate whether we wish to call LoadContent on the child</param> /// <param name="initialise">A flag to indicate whether we wish to call Initialise on the child</param> /// <returns></returns> public virtual K AddChild <K>(K childToAdd, bool load = false, bool initialise = false) where K : BaseObject { DebugUtils.AssertNotNull(childToAdd); DebugUtils.AssertNull(childToAdd.Parent); // Set the parent to be this childToAdd.Parent = this; return(Children.AddChild(childToAdd, load, initialise)); }