how to assign script to new gameobject in unity code example
Example: how to add a gameobject
/// <summary>
/// Creates a new Gameobject called Name_1
/// </summary>
public void AddGameObject()
{
GameObject testObject = new GameObject("Name_1");
}