How can I create empty GameObject with name and determined RectTransform setteings within existing one?

Hello comm unity )))

How can I create empty GameObject with name and determined RectTransform setteings within existing one?

I know I can just create:

var object= new GameObject("MyObject");

But how can I place it where I want and with all that RecTransform stuff values that I need???

For anyone stumbling across this just like i did, if you just need to spawn it at the current location this is a much cleaner solution:

GameObject yourObj = Instantiate(Resources.Load("Prefabs/yourObj"), this.transform.position, this.transform.rotation) as GameObject;
            yourObj.name = "yourObj";

if you need it in another object’s position replace “this” with anObj

if you need specific coords

GameObject yourObj = Instantiate (yourObj, new Vector3(50, 2, 50), transform.rotation);

if you need specific rotation:

GameObject yourObj = Instantiate (object, position, Quaternion.Euler(0, 90, 0));

and if you don’t need to adjust the name or anything just remove the

GameObject yourObj =

I managed this by using:

parentObj= childCount[childCount.Length - 1].transform; // searching for the last child, where I want to place my object
myObj = Instantiate(Resources.Load("Prefabs/Obj")) as GameObject;
myObj.name = "MyObj"; // setting name cuz prefab is giving (Clone) at the end
myObj.transform.parent =  parentObj; // putting my object whrere I want