private void CreateSprite() { Sprite sprite = Utility.CreateNewSprite((int)pixelRect.width, (int)pixelRect.height); if (sprite == null) { return; } GameObject gameObject = new GameObject(); gameObject.name = sprite.name; gameObject.AddComponent <SpriteRenderer> (); gameObject.transform.position = (worldMinPointSnapped + worldMaxPointSnapped) * .5f; gameObject.GetComponent <SpriteRenderer> ().sprite = sprite; gameObject.GetComponent <SpriteRenderer> ().sharedMaterial = Resources.defaultMaterial; Selection.activeGameObject = gameObject; SceneView.lastActiveSceneView.Focus(); }