Version: Unity 6.4 Alpha (6000.4)
LanguageEnglish
  • C#

TileAnimationEntityIdData

struct in UnityEngine.Tilemaps

/

Implemented in:UnityEngine.TilemapModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A struct for the required data for animating a Tile.

This is similar to TileAnimationData except it uses EntityIds instead of managed object references.

using Unity.Collections;
using UnityEngine;
using UnityEngine.Tilemaps;

public static class TilemapExample { public struct AnimatedEntityIdData { public TileData m_TileData;

public NativeArray<EntityId> m_AnimatedSpriteEntityIds; public float m_Speed; public float m_AnimationStartTime; public TileAnimationFlags m_TileAnimationFlags;

public void Dispose() { if (m_AnimatedSpriteEntityIds.IsCreated) m_AnimatedSpriteEntityIds.Dispose(); } }

static unsafe void GetTileAnimationEntityIdDataJob(int count, Vector3Int* position, ref AnimatedEntityIdData tileAnimationData, TileAnimationEntityIdData* outTilemapAnimationEntityIdData) { for (var i = 0; i < count; ++i) { ref TileAnimationEntityIdData outTilemapAnimationData = ref *(outTilemapAnimationEntityIdData + i); if (tileAnimationData.m_AnimatedSpriteEntityIds.IsCreated) outTilemapAnimationData.animatedSpritesEntityIds = tileAnimationData.m_AnimatedSpriteEntityIds; outTilemapAnimationData.animationSpeed = tileAnimationData.m_Speed; outTilemapAnimationData.animationStartTime = tileAnimationData.m_AnimationStartTime; outTilemapAnimationData.flags = tileAnimationData.m_TileAnimationFlags; } } }

The example above shows how you can copy a Tile's animation data to be passed to a Tilemap.

Properties

Property Description
animatedSpritesEntityIdsThe array of the Entityids of sprites, ordered by appearance in the animation.
animationSpeedThe animation speed.
animationStartTimeThe start time of the animation. The animation will begin at this time offset.
flags TileAnimationFlags for controlling the Tile animation.