Anisotropic dropdown control error
Hi! I'm trying to make an options menu where I've got resolutions/quality/v-sync/antialiasing etc... So I'm trying to make my drop down menu to have access to my anisotropic settings from my qualitySettings menu. So I've got 2 scripts called GameOptions and OptionsManager from GameOptions I'm setting my variables and in the OptionsManager I'm telling them what to do! Everything is OK but when I try to access my anisotropic variable I'm getting error "unity cannot implicitly convert type int to unityengine.anisotropicFiltering. An explicit conversion exist(are you missing a cast)" So can someone help me? Here is my script.
GameOptions;
public class GameOptions
{
public int anisotropic;
}
OptionsManager;
public class OptionsManager : MonoBehaviour
{
public Dropdown anisotropic;
public GameOptions gameOptions;
void OnEnable()
{
gameOptions = new GameOptions();
anisotropic.onValueChanged.AddListener(delegate { AnisotropicChange(); });
}
public void AnisotropicChange()
{
QualitySettings.anisotropicFiltering = gameOptions.anisotropic = anisotropic.value;
}
}
Answer by Bratveja · Feb 24, 2017 at 07:15 PM
Edit: I've finally made it for someone with my problem try this:
gameOptions.anisotropic = anisotropic.value;
if(anisotropic.value == 0)
{
QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable;
} else if (anisotropic.value == 1)
{
QualitySettings.anisotropicFiltering = AnisotropicFiltering.Enable;
} else QualitySettings.anisotropicFiltering = AnisotropicFiltering.ForceEnable;
First I'm setting the value to be accessible from the GameOptions script so I can save them later on! Then I'm checking if anisotropic is 0 if it is to use the disable function and so on