Unity 小地图 之 使用UGUI实现小地图一场景布置

 时间:2024-11-17 14:09:36

Unity 小地图 之 使用UGUI实现小地图一场景布置。本节介绍使用UGUI实现小地图功能的场景布置的简单案例,具体如下

工具/原料

Unity

UGUI

Render Texture

一、知识要点

1、RenderTexture:Inherits from:TextureRender textures are textures that can be rendere颊俄岿髭d to.They can be used to implement image based rendering effects, dynamic shadows, projectors, reflections or surveillance cameras.One typical usage of render textures is setting them as the "target texture" property of a Camera (Camera.targetTexture), this will make a camera render into a texture instead of rendering to the screen.Keep in mind that render texture contents can become "lost" on certain events, like loading a new level, system going to a screensaver mode, in and out of fullscreen and so on. When that happens, your existing render textures will become "not yet created" again, you can check for that withIsCreatedfunction.As with other "native engine object" types, it is important to pay attention to the lifetime of any render textures and release them when you are finished using them with theReleasefunction, as they will not be garbage collected like normal managed types.

2、方法提要:Layer 的使用,玩家和NPC的图标小地图渲染,实际场景的主摄像机不渲染

二、小地图 之 使用UGUI实现小地图一场景布置

1、打开Unity,新建一个空工程,具体如下

Unity 小地图 之 使用UGUI实现小地图一场景布置

3、选中“Player”和“Enemy”,新建一个“Human”层,并把“Player”和“Enemy”的层“Layer”都修改为“Human”,具体如下图

Unity 小地图 之 使用UGUI实现小地图一场景布置

5、选中“MainCamera”,去掉“Culling Mask”的“MiniMap”层,不让“MainCamera”进行渲染,具体如下图

Unity 小地图 之 使用UGUI实现小地图一场景布置

7、接着把“MiniMapCamera”的“Culling Mask”去掉“Human”层的渲染,具体如下图

Unity 小地图 之 使用UGUI实现小地图一场景布置

8、到此,《Unity 小地图 之 使用UGUI实现小地图一场景布置》讲解结束,谢谢

  • Unity 实用教程 之 透明物体遮住实体效果的实现
  • U3D如何准确的使用空对象
  • 如何生成Unity直接识别的ogv视频格式?
  • unity3d使用鼠标在场景中拖放物体
  • Unity 3D如何更改文字颜色
  • 热门搜索
    微信朋友圈 tplink路由器重置 坝上草原在哪里 个人档案存放在哪里 香精怎么用 电脑上如何截图 鼓浪屿旅游攻略自由行 怎么说我不爱你简谱 大写字母怎么打 塔寨村在哪里