Steps to resolve:
1. Add a camera, name Backgroundcamera, and add a background layer on the layer. and drag and drop the plane under the camera node. Then Backgroundcamera and plane are placed on the background layer, modify clearflags not depthonly depth rendering, and set Cullingmask to see only the background layer, and set depth to 1 , indicating that the background layer is the deepest, the other model is located in the camera's depth is the 0,ngui is 1, here the hierarchy relationship is Ngui in the front, the model layer second, then the background layer, so make sure 3D model in front of the background!
2. The same operation, the Maincamera set, note that the Maincamera Cullingmask can not contain the background layer, that is, so that it does not see the background layer, or there will be a background to mask the situation of the model.
3. Add a script on plane to dynamically load the map on plane
View Sourceprint?
01.
using UnityEngine;
02.
using System.Collections;
03.
using System.Collections.Generic;
04.
05.
public
class
AddBackground : MonoBehaviour
06.
{
07.
public
Texture2D mtexture;
08.
09.
void
Awake()
10.
{
11.
// Texture2D mtxture = new Texture2D(Screen.width, Screen.height);
12.
// renderer.material.mainTexture = mtxture;
13.
// mtxture.Apply();
14.
15.
gameObject.AddComponent<guitexture>();
16.
}
17.
18.
// Use this for initialization
19.
void
Start()
20.
{
21.
guiTexture.texture = mtexture;
22.
transform.localScale =
new
Vector3(
0
,
0
,
0
);
23.
transform.localPosition =
new
Vector3(
0
,
0
,
25
);
24.
guiTexture.pixelInset =
new
Rect(
65
,
0
, Screen.width, Screen.height);
25.
}
26.
}</guitexture>
The z-axis property of the Start method above is set to the original attempt, and the depth modification by z-axis is not position, or the layer relationship affects the depth of rendering.
4.
Unity3d Setting the 3D model to appear before the 2D background (multiple cameras layered) (RPM)