using System.Collections; using System.Collections.Generic; using UnityEngine; public class CampfireFog : MonoBehaviour { public GameObject Player; public Material FogMaterial; void Update() { FogMaterial.SetFloat("_Transparency", Mathf.Min(Mathf.Sqrt(Mathf.Max((transform.position - Player.transform.position).magnitude - 15, 0)) / 100, 0.15f)); } }