- Home /
Question by
scrubuch · Mar 19, 2017 at 08:00 PM ·
camerafadeoutculling maskfadein
How can I make a fade out transition when i change a culling mask?
Hi, i'm making a 3D topdown game and i make a script that change the cullingmask of the camera when i go to another floor, so for ex: if i'm on floor num 3 and i go to floor num 2, i didn't see the floor num 3. thats fine, but i wanna make some fadeout/in efect before changing the culling mask. How can i do it.
Here's the code i use to change the culling mask:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerFloorController : MonoBehaviour {
public int floor;
PlayerController p_ControllerScript;
float alphaStep = 0.01f;
void Awake()
{
p_ControllerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
}
void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
{
//Desactive
if(p_ControllerScript.p_Floor > floor)
{
Camera.main.cullingMask = ~(1 << p_ControllerScript.p_Floor);
p_ControllerScript.p_Floor = floor;
}
//Active
else if(p_ControllerScript.p_Floor != floor)
{
Camera.main.cullingMask |= 1 << floor;
p_ControllerScript.p_Floor = floor;
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Changing a GUITexture's alpha gives me no effect in game. 0 Answers
UI with layer always displaying 0 Answers
Layered cameras and culling mask not quite working. 0 Answers
A problem with second camera culling mask (Semi- Transparent) 0 Answers
Second UI camera only works when I refresh Clear Flags setting 1 Answer