How to draw dynamic sprites at the fixed position in the Unity 5?

Hello ladies and gentelemens!

I am used TexturePacker to creating of texture atlases.
It’s making a sprite collection after import to the Unity.

Questions:

  • How to dynamically create these spites at the scene? (For expample: 4 same potions in the inventory)
  • How to draw these sprites at the fixed position of scene? (For example: animated face of a hero)

Thank you for your attention.

I would make a prefab that has all the settings you want, with a placeholder sprite. The use Instantiate to add the prefab to the scene and finally change the sprite to the correct sprite. For example:

using UnityEngine;
using System.Collections;

public class AddSprite : MonoBehaviour {
    public GameObject myPrefab
   
    void AddNewSprite(Vector2 position, sprite newSprite) {
        GameObject go = Instantiate(myPrefab, position, Quaternion.identity) as GameObject;

        SpriteRenderer sr = go.GetComponent<SpriteRenderer>();

        sr.sprite = newSprite;
    }
}

Thank you!