- Home /
Color looks different in build than in editor - C#
The color of the gameobject is controlled by the following script.
using UnityEngine;
using System.Collections;
public class RangeScript : MonoBehaviour {
//Public variables
//Private variables
//Visible private variables
void Update()
{
//Changes visual radius of visualizer
TurretScript turretScript = transform.parent.GetComponent<TurretScript>();
transform.localScale = new Vector3(turretScript.Range, 0, turretScript.Range) / 10;
//FIX: Find a better way to check turrets element. This looks stupid.
//Changes color depending on turrets element
if (turretScript.Element == TurretScript.ElementType.Earth)
{
renderer.material.color = new Color(0.4f, 0.2f, 0);
}
if (turretScript.Element == TurretScript.ElementType.Fire)
{
renderer.material.color = Color.red;
}
if (turretScript.Element == TurretScript.ElementType.Water)
{
renderer.material.color = Color.blue;
}
}
}
Could it have anything to do with the average settings of the phone, or the brightness?
Are you using any image effects, have you tried adjusting Ambient Light in Render Settings, is Fog disabled, have you tried removing your script that effects the colors at runtime? What about your monitor's settings? Perhaps the brightness or contrast on your monitor needs adjusted? Different devices with different displays do sometimes have some differences with hue, saturation.... Just some ideas.
@Hoeloe It's using a simple transparent/diffuse shader.
@Clunk47 I haven't done anything special to the lighting, and it fog has been disabled. It doesn't have anything to do with any kind of settings on either of the screens, as the colors function correctly when viewing them on my phone through the remote. Additionally, I did try to manually change the color of the GO through the inspector, make a build of that and run it on my phone which looked just fine. For whatever reason it's linked to the code itself.