Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Nobuyuki-Kobayashi/e3a1df57b48d1e69d5917301d367400f to your computer and use it in GitHub Desktop.
Save Nobuyuki-Kobayashi/e3a1df57b48d1e69d5917301d367400f to your computer and use it in GitHub Desktop.
Unity : PostEffectMaskRendererHelper.cs
// 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