简体   繁体   English

如何在Unity中将2D场景和3D场景合并在一起

[英]How to merge 2D scene and 3D scene together in Unity

Hello I am currently building a game in 3D but i want to add a level in 2D, how to add a 2D scene to a 3D project.您好,我目前正在 3D 中构建游戏,但我想添加 2D 级别,如何将 2D 场景添加到 3D 项目。

If this is possible using c# script not with Orthographic projection on the camera.如果可以使用 c# 脚本,而不是在相机上使用正交投影。

There are few steps you have to do to make a 2D looking scene:要制作一个 2D 外观的场景,您只需执行几个步骤:

  1. Create a camera object创建一个摄像头 object
  2. Set the view to 'Ortographic'将视图设置为“正交”
  3. Set its transform to look at the Z axis forward/backward设置其变换以向前/向后查看 Z 轴
  4. Use Sprite renderers:)使用 Sprite 渲染器:)

In Unity, 2D and 3D are just a conversion of perspective.在Unity中,2D和3D只是透视的转换。 All objects have 3D coordinate information.所有物体都有3D个坐标信息。 When Vector3 is converted to Vector2 and the view mode is changed from perspective to orthogonal, the Z-axis information is meaningless.当 Vector3 转换为 Vector2 并且视图模式从透视更改为正交时,Z 轴信息无意义。 So, it changed from 3D to 2D.因此,它从 3D 变为 2D。 Select "Editor" under "Project Settings" in "Editor", change the "Mode" of "Default Behaviour Mode" under "Editor Settings" to "3D", and then "Ctrl + N" to create a new scene, this time is 3D development mode Select “Editor”中“Project Settings”下的“Editor”,将“Editor Settings”下“Default Behavior Mode”的“Mode”改为“3D”,然后“Ctrl+N”新建场景,这次是3D开发模式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM