- Home /
Question by
Kirki_333 · Apr 23, 2020 at 12:13 PM ·
uigraphicsassetsdynamic loading
How to make items created dynamically more spaced out?
So I have this calendar asset where the items (days) are getting created dynamically. I wanted to increase the font to make the text bigger but when I do that the items get really crowded. How can I create more space between them? Here you can see how they look and the scene hierarch when they get created dynamically.
Here is my code:
_calendarInstance = this;
Vector3 startPos = _item.transform.localPosition;
_dateItems.Clear();
_dateItems.Add(_item);
for (int i = 1; i < _totalDateNum; i++)
{
GameObject item = GameObject.Instantiate(_item) as GameObject;
item.name = "Item" + (i + 1).ToString();
item.transform.SetParent(_item.transform.parent);
item.transform.localScale = Vector3.one;
item.transform.localRotation = Quaternion.identity;
item.transform.localPosition = new Vector3((i % 7) * 31 + startPos.x, startPos.y - (i / 7) * 25, startPos.z);
_dateItems.Add(item);
How can this be fixed?
calendar-problem.png
(63.1 kB)
Comment
Your answer
Follow this Question
Related Questions
How to draw UI images with command buffers? 0 Answers
how do i link menu options to a button? 0 Answers
How to set "Packing Tag" to Sprites created at runtime? 0 Answers
Redraw canvas graphic on Update() 1 Answer
UI - Compatible graphics settings? 1 Answer