unity get component script from gameobject code example
Example: unity create gameobject with component
GameObject go = new GameObject("Test", typeof(MeshRenderer), typeof(MeshFilter), typeof(YourScript));
GameObject go = new GameObject("Test", typeof(MeshRenderer), typeof(MeshFilter), typeof(YourScript));