当前位置:网站首页>[Unity Getting Started Plan] Basic Concepts (8) - Tile Map TileMap 01
[Unity Getting Started Plan] Basic Concepts (8) - Tile Map TileMap 01
2022-08-03 16:08:00 【flashinggg】
目录
3 Tilemap Renderer Tile map renderer
3.1 Sort Order The tile arrangement order
3.3 Detect Chunk Culling Bounds How to detect boundaries
4 The creation process of the tile map
4.3 The tile map can be started
1 TileMap概念
Tilemapis used to create2Dgame world map,Common side view、俯视、斜45angle of view2DIt can be used to draw game maps.
主要思想
Draw each type of terrain in the game world as a separate block,例如RubyAdventureThe project resources provide different terrains that can be used to generateTile的精灵:
用正方形、菱形或者六边形One of the three as the shape of each piece separates the whole piece,Again like tiles/Assembled like tiles.on how to divide,后续会进行介绍.
优点
Improve the reusability of art resources,And using such a tool can greatly simplify the workload of mapping.
created hierarchy
一般在一个2D游戏项目中,TilemapCreation will be divided into three levels
- background——地图背景
- bound——边界
- foreground——前景,Mainly terrain
2 Unity中的TileMap
Unity中TileMapis used as a game object,for storage and handlingTile Assets,It's more like a system,将Tilestransfer to other related components.
Unity中的TileMap由五个部分组成:
2.1 auto parentGrid 网格
创建一个Tilemap:
GameObject -> 2D Object ->Tilemap选择类型
When we follow this path to create one瓦片地图时,UnityA parent object of the current tilemap object is automatically created(默认名称叫Grid),这个GridIt is equivalent to a collection of connected grids,Each grid will store oneTile,Grid的Cell Sizeand other properties can change the size of the grid.
2.2 Sprite精灵
在【Unity入门计划】基本概念(6)-精灵渲染器 Sprite RendererIntroduce what a sprite is,它其实就是一个2D的Texture容器.
2.3 Tile 瓦片
A tile contains a sprite and two components.创建方法:
Project窗口 -> Create -> 2D -> Tiles选择类型
新建的TileNeed to give it a sprite,That is to give it a texture.SelectYou can select the sprite.You can also change its collider type,默认是Sprite精灵.
2.4 Tile Palette 调色板
The tile map can be drawn quickly,There are two ways to create it:
第一,从Project面板创建
Project窗口 -> Create -> 2D -> Tile Palette选择类型
第二,创建了Tilemap后,从Scene打开PaletteWindow panel creation
Both require selection of the file path for storage.
2.5 Brush 笔刷
Tools in the palette for drawing tile maps.
3 Tilemap Renderer Tile map renderer
它是Tile MapA part of a GameObject,What the sprite renderer is for sprites,It is also used to control the currentTile在Tilemap上的渲染,有以下属性.
3.1 Sort Order The tile arrangement order
这个很简单,is to prescribe eachTile在整个Tilemapthe order of the above.The contextual relationship is reflected through the layer order.
3.2 Mode 渲染模式
渲染模式有两种
Chunk 分块渲染
Use tiled mode for batch rendering,This is also the default rendering method,选择ChunkThe post renderer groups tiles by location,Batch render the sprites on the tile together,The best rendering performance can be obtained in tilemaps.
Individual Render separately
Render each tile individually and take into account position and sort order.
3.3 Detect Chunk Culling Bounds How to detect boundaries
有两个值,Auto和Manual,自动和手动.The default is automatic monitoring.At this point the renderer will automatically check the sprite used.当选择ManualWhen you need to enter a value for the proposed boundary extension.
3.4 Mask Interaction 遮罩
This is similar to the sprite renderer,就不赘述,Once you use it, you will know what it does.
3.5 Material 材质
Defines the material used to render sprite textures.
The rest is the layer relationship,不赘述.
4 The creation process of the tile map
4.1 创建Sprite&Tile
First you need a tile that you want to be a tile map elementTile,Also need sprites as textures,So usually one is passed in2DPictures as sprites.
例如RubyAdventureOne is given in the official tutorialPNG纹理素材,Import and willType改为Sprite
下面是创建Tile,按照2.3The creation ideas in Create oneRule Tilebase tile,命名为BrickTile,And assign the sprite you just created to him.
4.2 创建Tilemap&Tile Palette
GameObject -> 2D Object ->Tilemap创建RectangularType of tilemap,Also the parent is created automaticallyGrid.
点开Palette Window,新建一个Palette命名为GamePalette,并将之前创建的Tile拖进去.
4.3 The tile map can be started
4.4 问题处理:Grid有缝隙
如下,The tile does not fill the entiretyGrid
更改TilemapThe pixel size of the sprite,更改成64即可.
修改后的结果:
This is how the tilemap is initially created,But for general projects,Provided will be a collection of multiple tiles,02section will introduce aboutTile的其他方面的内容.
边栏推荐
- How Navicat connects to MySQL on a remote server
- How much does Ark Survival Evolved cost?
- 神经网络,凉了?
- Research on power flow in DC microgrid based on Newton's method (Matlab code implementation)
- AI+BI+可视化,Sugar BI架构深度剖析
- 如何启动 NFT 集合
- STM32 GPIO LED和蜂鸣器实现【第四天】
- 方舟开服教程win
- 上亿数据怎么玩深度分页?兼容MySQL + ES + MongoDB
- 2021年数据泄露成本报告解读
猜你喜欢
为教育插上数字化的翅膀,网易云信发布「互联网+教育」整体解决方案
全新探险者以40万的产品击穿豪华SUV价格壁垒
Ark server open tool, server tutorial win
spark入门学习-1
Three key expectations for the crypto market in August Price moves north?Still expected to be in turmoil
一文看懂推荐系统:概要02:推荐系统的链路,从召回粗排,到精排,到重排,最终推荐展示给用户
并发编程的核心问题
我在滴滴做开源
红蓝对抗经验分享:CS免杀姿势
Ark server opening tutorial win
随机推荐
1、实例开启无锁表结构变更以后,在任务编排中通过“单实例SQL”节点进行的结构变更,是优先采用无锁表
mysql delete 执行报错:You can‘t specify target table ‘doctor_info‘ for update in FROM clause
JS basics--judgment
基于牛顿方法在直流微电网潮流研究(Matlab代码实现)
Go Go 简单的很,标准库之 fmt 包的一键入门
用户侧有什么办法可以自检hologres单表占用内存具体是元数据、计算、缓存的使用情况?
字典表(还需要输入2个字)
49 万奖金等你来拿!第四届实时计算 Flink 挑战赛启动,Beyond Stream Processing!
方舟开服工具、服务器教程win
兔起鹘落全端涵盖,Go lang1.18入门精炼教程,由白丁入鸿儒,全平台(Sublime 4)Go lang开发环境搭建EP00
生态剧变,电子签名SaaS模式迎来新突破,网络效应加速到来
扩展欧几里得求逆元实例
Optimal Power Flow (OPF) for High Voltage Direct Current (HVDC) (Matlab code implementation)
出海季,互联网出海锦囊之本地化
AWS中国区SDN Connector
How to start an NFT collection
How to get the 2 d space prior to ViT?UMA & Hong Kong institute of technology & ali SP - ViT, study for visual Transformer 2 d space prior knowledge!.
【数据库数据恢复】SqlServer数据库无法读取的数据恢复案例
请问大家,MySQL全量怎么样可以提高性能呢?我这里瓶颈是在Source上,在不增加并行度的情况下,
如何选择合适的损失函数,请看......