Place gameobject in between list of inspector gameobject
Here I am creating vertical scrollview based upon my requirement using Unity UI. In this scrollview, items gets added runtime so by default newly added item placed at last place. I want to put them at specific position.
My goal is to place newly instantiated gameobject at specific place like 3rd or 4th or whatever it is not at last always. Please give me some help in this.
Answer by siddharth3322 · Jul 05, 2016 at 11:25 AM
For this purpose, you can use different sibling methods of transform component. Like this way:
Here is example code to put your gameobject at specific position in hierarchy.
competitionImageObj.transform.SetSiblingIndex (profileContainer.childCount - 3);
Your answer
Follow this Question
Related Questions
Horizontal/Vertical Layout Group forcing control? 0 Answers
Scroll View with Dynamic Spacing 0 Answers
UI Text sometimes renders when instantiated, yet sometimes does not. 1 Answer
How do I Iterate through child UI buttons to change their images? 0 Answers
OnpointerClick not working(parents gameObject has EventTrigger) 0 Answers