

The issue I am facing is there doesnt seem to be a way to do this without me writing my own parser(whether its json, xml or any other format), create a 2dTexture from the atlas, THEN creating a sprite from the texture. What I want to do is develop a way that will allow me to say either "SomeGameObject.GetSpriteFromAtlas(name)" or "Material.GetSpriteFromAtlas(name)". I followed the tutorial at and it seems the script does its work and recognizes the individual textures in the Unity Editor. This makes the player movement device independent.I've created an atlas through texture packer and have used the texturepacker importer script for Unity. ltatime gives the time interval in seconds from the last frame to the current one. Input.GetAxis takes input from the keyboard

Rotate player when moving in the opposite direction disable Animator when no key is pressed Start is called before the first frame updateįloat posupdate= Input.GetAxis ("Horizontal") * ltaTime*2f In the code, you take the input from the keyboard and add it to the player position.
Texturepacker unity 2d download#
In Unity 2020 or previous versions you can download the TexturePacker Importer from the Unity Asset store.
Texturepacker unity 2d free#
That’s why we’ve created a free Unity asset called TexturePacker Importer that automates the process for you. You would have to split the sprites manually if you just copy and paste the sprite sheet into Unity. I am using Unity 2021.1.13f1 for this tutorial.

tpsheet extension.Ĭreate a new 2D project in Unity. One will be an image file (.png) and the other will be a data file with. You will get two files when you publish a sprite sheet. This algorithm is slower than MaxRects but allows you to pack more sprites on a single texture in many cases.Ĭlick Publish sprite sheet to generate and save your sprite sheet as “Background-sprites” and “Character-sprites”. I recommend that you use POT (Power of 2) whenever possible.Įxperiment with the packing by setting the Algorithm to Polygon. To create smaller sprite sheets, set Size constraint to AnySize - but this will give you warnings in Unity about mipmap creation. You should see a preview of your sprite sheet in the center view.Add the character sprites to the character project and the background sprites to the background project. Drag and drop the folder containing your sprites onto the TexturePacker window.Create separate projects in TexturePacker for background and character sprite sheets and name them Character-sprite-sheet and Background-sprite-sheet by clicking Save project in the toolbar.We are going to use a background sprite sheet, and a character sprite sheet for our game.Set the Data format in the right panel to Unity - Texture2D sprite sheet.
Texturepacker unity 2d install#
Using TexturePacker to make sprite sheetĭownload TexturePacker and install it on your computerįollow the steps below to make your sprite sheet In this tutorial, we will use TexturePacker to make a sprite sheet and use it in a simple Unity game scene.
