- Home /
Unity5 sprite.create perfomance issue in editor?
I created simple script that creates 100 empty gameobjects with SpriteRenderer component attached on startup. SpriteRenderer.sprite property is linked to new sprite.create. In Unity 4.6.3f1 if you hit play in editor scene starts immediately, but this same projects in Unity 5.0.0f4 starts almost 16 seconds!!! I tryed on several PC's running Win7 64bit and this issue reproduced 100%. This is not reproduced on compiled app (standalone app, web player app) ONLY in Editor mode.
Script code: void Start () {
Rect Source = new Rect(0,0,1000,1000);
Vector2 Pivot = new Vector2(0.5f, 0.5f);
for (int i = 0; i < 100; i++)
{
Sprite tileSprite = Sprite.Create(Texture, Source, Pivot, 100, 0);
GameObject obj = new GameObject();
obj.transform.parent = this.transform;
SpriteRenderer spriteRend = obj.AddComponent<SpriteRenderer>();
spriteRend.sprite = tileSprite;
obj.transform.position = new Vector3(0, i * 0.5f, 0);
}
}
Your answer
Follow this Question
Related Questions
How to match UI Image size with sprite size at runtime? 2 Answers
Use sprite mesh for filled image 1 Answer
Unity 5 Car Audio script issues 0 Answers
RESTful APIs with authentication in Unity 5? 0 Answers
How can i Learn Basics of Rain AI 1 Answer