Question by
drjfgi · Apr 27, 2017 at 12:52 PM ·
scripting problembugsinstantiate-objects
Instances fracture sometimes
What am I doing wrong... lots of products on shelves and most of the time they are displayed correctly. But sometimes an instance breaks into shards. Any suggestions?
Thank you
for (int y = -5; y <= 0; y++)
{
// side to side (facing left to right)
for (int z = -5; z <= 2; z++)
{
int goodsID = Random.Range(0, ij);
GameObject Item = Instantiate(GoodsPrefabs[goodsID], shelfgondola[i].transform);
Item.name = GoodsPrefabs[goodsID].name;
Item.transform.localScale = new Vector3(0.14f, 10, .1f);
Item.transform.localPosition = shelfgondola[i].transform.localPosition
+ new Vector3(y * 0.145f, 0.7f, 0.2f+z * 0.12f);
Item.transform.parent = null;
}
}
capture.png
(412.7 kB)
Comment
Your answer
Follow this Question
Related Questions
It seems that Unity 5.4.1 has bug !!! 0 Answers
Finishing up my 2D quiz game [Last Problem] 0 Answers