CreateNewSprite() публичный статический Метод

public static CreateNewSprite ( int sizeX, int sizeY ) : Sprite
sizeX int
sizeY int
Результат UnityEngine.Sprite
Пример #1
0
        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();
        }