public Listcopy = new List ();
Below I have a method that works, it receives the List AllowedActionst and I can use it in this method. However how do I use this List in another method in the same class?
public void BettingRound (NetworkPlayer actors, int Xpos, int Ypos, List AllowedActionst, int bet) {
//var foundScript = GetComponent<AllowedActions> () as AllowedActions;
List<string> copy = new List<string>(AllowedActionst);
foreach (string i in copy) { Debug.Log(i + "copyyyyy ");}
For example I tried using the AllowedActionst List in the below method in the same class, but
the list is always giving a null reference it is empty.
I tried therefore to copy the AllowedActionst List into a new List named copy and made it public.
But still the same issue, if I use if (copy.contains…) the list is always empty. Even though the Debug.Log above does say it has 4 strings in copy however as you can see below that Debug.Log always shows null.
In other words how do I use the contents of the AllowedActionst List in the below
sendBetToServer() method so that it still has the same contents?
I thought making it public by declaring it outside of the methods would make it work even though it is initalising in the BettingRound method.
Hope this makes sense.
public void sendBetToServer() {
BetButtonPressed = true;
string ActionActor = "Bet";
foreach (string i in copy) { Debug.Log(i + "this always shows an empty List/ null reference???? ");}
//List<Player> Activeplayerss = foundScript2.getActivePlayers();
// var foundScript55 = gameObject.GetComponent<AllowedActions>();
// List<string> AllowedActio = foundScript55.GetAllowedActions ();
GameObject fiets8 = GameObject.Find ("clone2");
myslider = fiets8.GetComponent<Slider> ();
if (copy.Contains ("Raise")) { GameObject fiets1 = GameObject.Find ("clone1");
fiets1.SetActive (false);}
if (copy.Contains ("Raise")) {GameObject fiets2 = GameObject.Find ("clone2");
fiets2.SetActive (false);}
if (copy.Contains ("Check")) {GameObject fiets3 = GameObject.Find ("clone3");
fiets3.SetActive (false);}
if (copy.Contains ("Fold")) {GameObject fiets4 = GameObject.Find ("clone4");
fiets4.SetActive (false);}
if (copy.Contains ("Call")) {GameObject fiets5 = GameObject.Find ("clone5");
fiets5.SetActive (false);}