unity get gameobject by component code example
Example 1: unity create gameobject with component
GameObject go = new GameObject("Test", typeof(MeshRenderer), typeof(MeshFilter), typeof(YourScript));
Example 2: unity gameobject.getcomponent
rb = GetComponent<Rigidbody>();