Quantcast
Channel: Questions in topic: "item"
Viewing all articles
Browse latest Browse all 274

Disable a dropdown option.

$
0
0
So I'm making a weapon switching dropdown to change your weapon. And the thing is, I want the weapons to unlock on a specific level. The level is stored in my GameSettings class, I know how to access that, but the problem is, I can't get the item's index and disable the item. My item's code: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class item : MonoBehaviour { public Text label; public GameSettings settings; private void Start() { if (settings.level >= 1 && label.text != "AK-47") { GetComponent().interactable = false; } else { GetComponent().interactable = true; } if (settings.level >= 6 && label.text != "AK-47" || label.text != "M4") { GetComponent().interactable = false; } else { GetComponent().interactable = true; } if (settings.level >= 17 && label.text != "AK-47" || label.text != "M4" || label.text != "870 Shotgun") { GetComponent().interactable = false; } else { GetComponent().interactable = true; } if (settings.level >= 22) { GetComponent().interactable = true; } } }

Viewing all articles
Browse latest Browse all 274

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>