- Home /
Fog doesn't work on Android
RenderSettings.fog doesnt work on Android.I made game for Android. But on Android fog doesn't work. On PC fog is working. Help me how to solve this problem. Thank you in advance!
ON ANDROID ON PC
I created this C# script:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class UnderWater : MonoBehaviour { public float waterlevel; private Color normal; private Color under; public ParticleSystem partc; public Rigidbody plejer; // Use this for initialization void Start () { normal = new Color(0.5f,0.5f, 0.5f, 0.5f); under = new Color(0.2f, 0.4f, 0.5f, 0.8f); plejer = GetComponent(); }
// Update is called once per frame
void Update () {
if (plejer.position.y<waterlevel)
{
partc.Play();
RenderSettings.fog = true;
RenderSettings.fogColor = under;
RenderSettings.fogDensity = 0.04f;
}
if (plejer.position.y >= waterlevel)
{
partc.Pause();
partc.Clear();
RenderSettings.fog = true;
RenderSettings.fogColor = normal;
RenderSettings.fogDensity = 0.005f;
}
}
}
Answer by Gold_Rush · Mar 25, 2018 at 03:29 PM
I confirm! I also can't turn on fog from code.
Fog works on Android only if turn on it in scene settings previously :(
Go to Window->Lighting in opened window select Scene. Turn on Fog and save youre scene. Disable fog at start in code, if it is not needed Build and Run project.
Your answer
Follow this Question
Related Questions
problem with exporting the game to android 0 Answers
Android Ads Error 2 Answers
Error android build 0 Answers
Game FPS Down When Phone is going to Asleep(Or Lock) in Android 1 Answer
LWRP has higher Requirements? 2 Answers