Created
April 18, 2018 15:54
-
-
Save Nobuyuki-Kobayashi/e3a1df57b48d1e69d5917301d367400f to your computer and use it in GitHub Desktop.
Unity : PostEffectMaskRendererHelper.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the helper script for PostEffectMaskRenderer.cs and attaches "MainCamera(with PostEffectMask)" | |
// to the "Mask" property of Post Effect Mask Renderer component. | |
// Attach to the gameobject with Post Effect Mask Renderer component. | |
// | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[RequireComponent(typeof(PostEffectMaskRenderer))] | |
public class PostEffectMaskRendererHelper : MonoBehaviour { | |
GameObject mainCamera; | |
PostEffectMask maskCamera; | |
void Awake(){ | |
mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); | |
maskCamera = mainCamera.GetComponent<PostEffectMask>(); | |
} | |
// Use this for initialization | |
void Start () { | |
this.GetComponent<PostEffectMaskRenderer>().mask = maskCamera; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment