- Home /
Question by
ObJobs · Aug 21, 2020 at 04:18 PM ·
uipositionprefabsprefab-instance
2D UI prefab instantiating wrong position, I can't instatiate my UI prefab in a specific point
I am trying to make a script that puts these UIs in a kind of "family" tree and that these UIs are added whenever the player wants to add a "family". After some trial and error, I noticed that even if I set the spawn coordinates to (x = 1, y = 1) the instantiation occurred in x = 407 and y = 213.
var newparagrafo = Instantiate(alberoprefab, new Vector2((transform.position.x), (transform.position.y)), Quaternion.identity) as GameObject;
newparagrafo.transform.SetParent(makebook, false);
newparagrafo.transform.position = new Vector2(1, 1);
even the size is wrong (too big). any solution?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613010205im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Instantiating Mesh Error - Mesh has Instance added? 1 Answer
Camera rotation around player while following. 6 Answers
Not sure how to change color of individual prefab instance after it was touched 0 Answers
Injecting data into Prefabs 1 Answer
How to control position of GUITexture when its inside a prefab 0 Answers