Как сделать атлас unity

Sprite Atlas

Sprite Atlas is an asset

Sprite Atlas is created via the menu option in the Editor and will stay as an asset in the project’s folder (*.spriteatlas).

Unified Settings

Sprite Atlas asset provides a set of texture settings for the packed texture. Regardless what was the texture settings of the sprite being pack in an atlas, the result atlas texture will only respect the settings in the atlas asset.

Runtime access

Sprite Atlas asset has a runtime representation which can be accessed during Runtime.

Variants

User will be able to create another Sprite Atlas asset and declared it is a variant of one existing Sprite Atlas in the project. It then will duplicate the master’s atlas texture and resize it according to a multiplier.

Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

How to create a Sprite Atlas

Properties

Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

PropertyFunction
TypeSets the type of atlas to be either a Master or Variant Atlas.
Include in buildAlways includes the Atlas Asset in the build.
Allow RotationAllows sprites to be rotated for packing
Tight PackingNon-rectangle packing
Read/Write EnabledSet this to true if you want texture data to be readable from scripts. Set it to false to prevent scripts from reading texture data.
Generate Mip MapsSelect this to enable mip-map generation. Mip maps are smaller versions of the Texture that get used when the Texture is very small on screen.
Filter ModeSelect how the Texture is filtered
Platform-specific overrides panelUse the Platform-specific overrides panel to set default options (using Default), and then override them for a specific platform using the buttons along the top of the panel.
https://docs.unity3d.com/Manual/class-TextureImporterOverride.html
Objects For PackingThe objects to be included in the packed Atlas. Folders, Textures or individual sprites can be added to the list.

Assigning assets to be atlased

Folders, Textures or Sprites can be assigned to the Sprite Atlas. Entire folders can be assigned to the Sprite Atlas asset, all Textures within that folder including subfolders will be packed. When assigning an individual Texture, all defined sprites will be included. Single sprites can also be assigned to the atlas and other sprites within the same Texture will not be considered.

Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

    To include assets to be atlased, select the Atlas asset and add them by either adding new entry to the list or dragging and dropping them from the Project onto the list area in the inspector. You can add the folders, textures, sprites to the atlas.

    Set the desired settings for the generated atlas. Changes to the setting will always mark this atlas as modified and will be packed again during the packing phase.

    The packed atlas can be previewed by pressing the “Pack Preview” button in the inspector. This will trigger a packing for this atlas. Once the packing is done, the texture will appear in the preview section.

    All atlases with modified settings will be packed before entering Play Mode (if Always Enabled is selected).

    Down-scaled variant (HD/SD)

    User will be able to create another Sprite Atlas asset and declare it is a variant of an existing Sprite Atlas in the project. It will then duplicate the Master’s atlas texture and resize it according to a multiplier.

    Creating a Sprite Atlas variant

    Set the Type for the Sprite Atlas to Variant. Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

    Assign an atlas to the Master Atlas slot. Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

    Set the scaling factor for the variant. Value can be from 0.1 to 1.

    To bind the variant atlas as default instead of the master, just check the “Include in build” option in the variant and uncheck the option in master.

    Checking both will randomly include one of the atlas (master/variant). You might want to uncheck both to have late binding, mentioned below.

    Runtime sprites enumeration

    Create a custom component that takes a “SpriteAtlas” as a variable.

    Assign any of your existing Sprite Atlas to the field.

    Enter play mode or run the player.

    Access the variable and notice you can now call the property “.GetSprites” to get the array of Sprites packed in this atlas.

    Late Binding

    A Sprite can be started in runtime as “packed but not referencing any atlas” and will appear blank until an atlas is bound to it. The benefit of this behaviour is to allow user to have chance to do late binding if the source of the atlas is not available during startup e.g. asset bundles downloaded from the web.

    Late Binding via callback

    As long as the Sprite is packed into any Sprite Atlas but the sprite atlas is not bound as default (e.g. unchecked “Include in build” option) the Sprite will be invisible in the scene.

    User can listen to callback SpriteAtlas.atlasRequested.

    This delegate method will provide a tag of atlas which suppose to bind and a System.Action which takes in a SpriteAtlas asset. User is expected to load the asset by any mean (script references, Resources.load, Asset bundle) and supply the asset to the System.Action.

    2017–05–26 Page published with no editorial review

    New in Unity 2017.1 NewIn20171

    Did you find this page useful? Please give it a rating:

    Источник

    Sprite Atlas

    Sprite Atlas is an asset

    Sprite Atlas is created via the menu option in the Editor and will stay as an asset in the project’s folder (*.spriteatlas).

    Unified Settings

    Sprite Atlas asset provides a set of texture settings for the packed texture. Regardless what was the texture settings of the sprite being pack in an atlas, the result atlas texture will only respect the settings in the atlas asset.

    Runtime access

    Sprite Atlas asset has a runtime representation which can be accessed during Runtime.

    Variants

    User will be able to create another Sprite Atlas asset and declared it is a variant of one existing Sprite Atlas in the project. It then will duplicate the master’s atlas texture and resize it according to a multiplier.

    Sprite Packer Settings

    The Sprite Packer is disabled by default but you can configure it from the Editor settings (go to Edit > Project Settings > Editor). You can change the sprite packing mode from Disabled to either:

    Use Always Enabled when testing packed Sprites loaded from an Asset Bundle during Play mode.

    Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

    How to create a Sprite Atlas

    Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

    Свойство:Функция:
    TypeSets the type of atlas to be either a Master or Variant Atlas.
    Include in buildAlways includes the Atlas Asset in the build.
    Allow RotationAllows sprites to be rotated for packing
    Tight PackingNon-rectangle packing
    Read/Write EnabledSet this to true if you want texture data to be readable from scripts. Set it to false to prevent scripts from reading texture data.
    Generate Mip MapsSelect this to enable mip-map generation. Mip maps are smaller versions of the Texture that get used when the Texture is very small on screen.
    Filter ModeSelect how the Texture is filtered
    Platform-specific overrides panelUse the Platform-specific overrides panel to set default options (using Default), and then override them for a specific platform using the buttons along the top of the panel.
    https://docs.unity3d.com/Manual/class-TextureImporterOverride.html
    Objects For PackingThe objects to be included in the packed Atlas. Folders, Textures or individual sprites can be added to the list.

    Assigning assets to be atlased

    Folders, Textures or Sprites can be assigned to the Sprite Atlas. Entire folders can be assigned to the Sprite Atlas asset, all Textures within that folder including subfolders will be packed. When assigning an individual Texture, all defined sprites will be included. Single sprites can also be assigned to the atlas and other sprites within the same Texture will not be considered.

    Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      To include assets to be atlased, select the Atlas asset and add them by either adding new entry to the list or dragging and dropping them from the Project onto the list area in the inspector. You can add the folders, textures, sprites to the atlas.

      Set the desired settings for the generated atlas. Changes to the setting will always mark this atlas as modified and will be packed again during the packing phase.

      The packed atlas can be previewed by pressing the “Pack Preview” button in the inspector. This will trigger a packing for this atlas. Once the packing is done, the texture will appear in the preview section.

      All atlases with modified settings will be packed before entering Play Mode (if Always Enabled is selected).

      Down-scaled variant (HD/SD)

      User will be able to create another Sprite Atlas asset and declare it is a variant of an existing Sprite Atlas in the project. It will then duplicate the Master’s atlas texture and resize it according to a multiplier.

      Creating a Sprite Atlas variant

      Set the Type for the Sprite Atlas to Variant. Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      Assign an atlas to the Master Atlas slot. Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      Set the scaling factor for the variant. Value can be from 0.1 to 1.

      To bind the variant atlas as default instead of the master, just check the “Include in build” option in the variant and uncheck the option in master.

      Checking both will randomly include one of the atlas (master/variant). You might want to uncheck both to have late binding, mentioned below.

      Runtime sprites enumeration

      Create a custom component that takes a “SpriteAtlas” as a variable.

      Assign any of your existing Sprite Atlas to the field.

      Enter play mode or run the player.

      Access the variable and notice you can now call the property “.GetSprites” to get the array of Sprites packed in this atlas.

      Late Binding

      A Sprite can be started in runtime as “packed but not referencing any atlas” and will appear blank until an atlas is bound to it. The benefit of this behaviour is to allow user to have chance to do late binding if the source of the atlas is not available during startup e.g. asset bundles downloaded from the web.

      Late Binding via callback

      As long as the Sprite is packed into any Sprite Atlas but the sprite atlas is not bound as default (e.g. unchecked “Include in build” option) the Sprite will be invisible in the scene.

      User can listen to callback SpriteAtlas.atlasRequested.

      This delegate method will provide a tag of atlas which suppose to bind and a System.Action which takes in a SpriteAtlas asset. User is expected to load the asset by any mean (script references, Resources.load, Asset bundle) and supply the asset to the System.Action.

      2017–05–26 Page published with no editorial review

      Источник

      Variant Sprite Atlas

      A Variant Sprite Atlas is a type of Sprite Atlas A texture that is composed of several smaller textures. Also referred to as a texture atlas, image sprite, sprite sheet or packed texture. More info
      See in Glossary that does not contain its own list of selected Textures as it has no Objects for Packing list in its properties. Instead, it receives a copy of the content from the Sprite A 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
      See in Glossary Atlas set as its Master Atlas.

      Variant Sprite Atlases are an optional step in the Sprite Atlas Workflow. Their main purpose is to create a variation of another Sprite Atlas’ Textures but with a different scaled resolution.

      To create a Variant Sprite Atlas:.

      Prepare the Sprite Atlas that will be the Variant Atlas’ Master Atlas. It contains the Texture Assets that the Variant Atlas will derive its own content from.

      Create a new Sprite Atlas, and set its Type to ‘Variant’.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      Assign the Sprite Atlas prepared in Step 1 to this property to set it as the Variant’s Master.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      In a Project that includes both a Master and a Variant Sprite Atlas, if both are Included in the Build, then the Textured used by mutual Sprites can come from either Sprite Atlas (refer to Scenario 3 of the Resolving different Sprite Atlas scenarios page).

      To automatically load Sprite Textures from the Variant Atlas instead of the Master Atlas, enable Include in Build for the Variant Atlas only and disable it for the Master Atlas. The build then automatically loads the Variant Sprite Atlas instead of the Master Atlas at run time.

      Scale the Textures of a Variant Sprite Atlas

      A Variant Sprite Atlas scales the Textures it gets from its Master Atlas via its Scale property. The resolution of the Variant Atlas’ Texture is the result of the Master Atlas’ Texture multiplied by the Scale factor.

      Set the Scale of the Variant Atlas from the range of 0.1 to 1:

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      Create multiple Variant Atlases with the same Master Atlas and different Scale values to create lower-resolution copies of the Atlas Texture. This is useful if you want to create various Variant Atlases for a range of platforms with different hardware limitations.

      Источник

      Sprite Atlas version 2 (Experimental)

      The current Sprite Atlas A texture that is composed of several smaller textures. Also referred to as a texture atlas, image sprite, sprite sheet or packed texture. More info
      See in Glossary packs Textures (from Sprites, Sprites within Textures, and Sprites in folders) into an Atlas Texture. It packs these Textures when it enters Play Mode, or when it builds the Player or an AssetBundle.

      To configure the packing behavior, go to Edit > Project Settings > Editor > Sprite Packer and select an option from the Mode drop-down menu.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unitySetting Sprite Packer Mode to Sprite Atlas V2 Experimental.

      Cache Server support

      Multi-process Asset import

      The v2 experimental system is developed with the following criteria in mind:

      Use an Importer workflow that supports Cache Server and other ADBV2 features.

      No changes to the Sprite Atlas Runtime Object.

      Ensure that there is a migration path between current Sprite Atlases to Sprite Atlas V2.

      No major changes to the UX workflow.

      Sprite Atlas version 2 Inspector properties

      There are no changes to the Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
      See in Glossary properties and settings from that of Sprite Atlas v1 except for the following :

      You cannot drag a folder directly onto Objects for Packing to add the contents for packing in Sprite Atlas v2, however dragging Sprites and Textures directly onto the window is still supported.

      The imported Sprite Atlas object is displayed at the bottom of the Inspector.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unityUpdated Inspector properties.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      When you enable the experimental Sprite Atlas v2:

      It becomes the default Mode when you create a Sprite Atlas through the Assets menu (Assets > Create > Sprite Atlas).

      Unity automatically migrates all existing Sprite Atlas v1 Assets to Sprite Atlas v2.

      Due to the automatic migration, you should make a backup of your v1 Sprite Atlases before you enable Sprite Atlas v2. Assets converted to v2 are incompatible with v1, and cannot be converted back.

      Editing Sprite Atlas v2 via scripting is currently not supported.

      Источник

      Sprite Atlas workflow

      Follow the steps below to create a Sprite A 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
      See in Glossary Atlas:

      Create a Sprite Atlas Asset

      Selecting items for the Objects for Packing list

      The Objects for Packing list displays the currently selected items that are in the Sprite Atlas. You can place Texture2D and Sprite Assets in this list. Drag and drop a folder directly onto the list to automatically add all valid content within the folder to the list (only the folder appears on the list).

      To select specific items for the list:

      Select the Sprite Atlas Asset and find the Objects For Packing list in its Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
      See in Glossary window. It displays the list of items for Unity to pack when it builds the Sprite Atlas.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      To add items, select the plus (+) icon at the lower right of the list to create a new row. Drag a valid Asset onto an empty row to add it to the list, or select the circle icon to the right of the row to open the Select Object window. Select an Asset from the Object Picker window to add it to the list:

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      To remove an item from the list, click the minus () icon at the lower right of the Objects For Packing list. To replace an item, drag another item to the row it occupies to replace it on the list.

      Select Pack Preview to preview the combined Atlas Texture in the Asset Preview window.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      Include in Build

      All Sprite Atlases have Include in Build enabled by default when created. This means that Unity includes the Sprite Atlases with the Project’s build The process of compiling your project into a format that is ready to run on a specific platform or platforms. More info
      See in Glossary and automatically loads them at the build’s run time. Enable or disable the ‘Include in Build’ property to control which Sprite Atlases are included in the Project build.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unity

      Clearing ‘Include in Build’ disables this behavior, and is done when preparing a Sprite Atlas for distribution.

      How to optimize Sprite Atlas usage and size for improved performance

      To optimize Sprite Atlas usage, ideally all or most Sprites that are active in the Scene should belong to the same Atlas. It is good practice to split Sprite Textures into multiple smaller Atlases according to their common usage.

      Another way to reduce performance overhead is to reduce the empty space between packed Textures in the Sprite Atlas. This reduces the size of the Sprite Atlas. To do this, select the Sprite Atlas and inspect the packed Atlas Texture in the Pack Preview window at the bottom of its Inspector settings. If there is no Preview available, select the Pack Preview button under the Objects for Packing list to generate the packed Texture.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unitySprite Atlas with excess empty space.

      If there is excess empty space visible, you can manually reduce the size of the packed Texture to reduce the amount of empty space and optimize the Atlas’s size. To do so, go to the Platform-specific overrides panel at the bottom of the Inspector window. Select a lower value from the drop-down menu of the Max Texture Size setting, then select Pack Preview to regenerate the packed Texture.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unitySet the Max Texture Size.

      When the Max Texture Size value is lower than the current dimensions of the Sprite Atlas Texture, Unity reduces the packed Texture dimensions to match the set Max Texture Size as closely as possible, and automatically trims away any extra empty space. If there are selected Sprite Textures that exceed the Max Texture Size setting of the Sprite Atlas, then the Sprite Atlas ignores the Max Texture Size setting and remains at the minimum size required to contain the Sprite Textures at their original dimensions.

      Как сделать атлас unity. Смотреть фото Как сделать атлас unity. Смотреть картинку Как сделать атлас unity. Картинка про Как сделать атлас unity. Фото Как сделать атлас unityTextures in a Sprite Atlas remain in their original dimensions.

      Источник

      Добавить комментарий

      Ваш адрес email не будет опубликован. Обязательные поля помечены *