-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPortalTextureSetup.cs
More file actions
31 lines (25 loc) · 979 Bytes
/
PortalTextureSetup.cs
File metadata and controls
31 lines (25 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PortalTextureSetup : MonoBehaviour {
public Camera cameraDarkWorld;
public Camera cameraLightWorld;
public Material cameraMaterialDarkWorld;
public Material cameraMaterialLightWorld;
// Use this fo initialization
void Start ()
{
if(cameraLightWorld.targetTexture != null)
{
cameraLightWorld.targetTexture.Release();
}
cameraLightWorld.targetTexture = new RenderTexture(Screen.width, Screen.height, 24);
cameraMaterialLightWorld.mainTexture = cameraLightWorld.targetTexture;
if (cameraDarkWorld.targetTexture != null)
{
cameraDarkWorld.targetTexture.Release();
}
cameraDarkWorld.targetTexture = new RenderTexture(Screen.width, Screen.height, 24);
cameraMaterialDarkWorld.mainTexture = cameraDarkWorld.targetTexture;
}
}