Skip to content

Instantly share code, notes, and snippets.

@IshidaGames
Created May 29, 2019 07:22
Show Gist options
  • Save IshidaGames/046d6012b95f9b605946a8202e27ed75 to your computer and use it in GitHub Desktop.
Save IshidaGames/046d6012b95f9b605946a8202e27ed75 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class lensFlare : MonoBehaviour {
LensFlare lf;
public GameObject player;
void Start () {
lf = GetComponent<LensFlare>();
}
void Update () {
//このオブジェクトとPlayerの距離で強さを決める
lf.brightness = 10 / Vector3.Distance(lf.transform.position,
player.transform.position);
//フェードするスピードを指定
lf.fadeSpeed = 0.5F;
//色を指定
lf.color = Color.red;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment