Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Error CS1502 And Error CS1503

Discussion in 'Scripting' started by monstergrunt09, May 19, 2019.

  1. monstergrunt09

    monstergrunt09

    Joined:
    Aug 15, 2018
    Posts:
    58
    Before making some changes to another script i get these 2 errors.

    Heres my full script

    Code (CSharp):
    1. // dnSpy decompiler from Assembly-CSharp.dll class: SurvivalMechanics
    2. using System;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5. using CodeStage.AntiCheat.ObscuredTypes;
    6. using Photon;
    7. using TranslatorSystem;
    8. using UnityEngine;
    9.  
    10. public class SurvivalMechanics : Photon.MonoBehaviour
    11. {
    12.     private void Awake()
    13.     {
    14.         SurvivalMechanics survivalMechanics = Resources.Load("SurvivalWaves", typeof(SurvivalMechanics)) as SurvivalMechanics;
    15.         this.waves = new List<SurvivalMechanics.waveInfo>();
    16.         for (int i = 0; i < survivalMechanics.waves.Count; i++)
    17.         {
    18.             this.waves.Add(survivalMechanics.waves[i]);
    19.         }
    20.         this.waves.Add(this.bossWave);
    21.         ObscuredPrefs.SetBool("Shop", false);
    22.         this.audioSource = base.GetComponent<AudioSource>();
    23.         this.waves[0].music = this.audioSource.clip;
    24.         this.originalVolume = this.audioSource.volume;
    25.         if (this.largeMap)
    26.         {
    27.             this.maxNPC = 20;
    28.         }
    29.         GameObject[] array = GameObject.FindGameObjectsWithTag("ShopPoint");
    30.         this.shopPoints = Array.ConvertAll<GameObject, Transform>(array, (GameObject x) => x.transform);
    31.         this.realMaxNPC = this.maxNPC;
    32.     }
    33.  
    34.     private void OnEnable()
    35.     {
    36.         GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(Resources.Load("Shop") as GameObject);
    37.         this.shop = gameObject.GetComponent<ShopSystem>();
    38.         gameObject.transform.position = Vector3.zero;
    39.         if (this.isOutside)
    40.         {
    41.             this.helicopter = UnityEngine.Object.Instantiate<GameObject>(Resources.Load("SupplyHelicopter") as GameObject);
    42.             this.helicopter.transform.position = new Vector3(0f, 250f, 0f);
    43.         }
    44.         if (!this.isOutside)
    45.         {
    46.             for (int i = 0; i < this.shopPoints.Length; i++)
    47.             {
    48.                 GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(Resources.Load("SupplyCrate") as GameObject);
    49.                 gameObject2.name = "SupplyCrate";
    50.                 gameObject2.transform.parent = this.shopPoints[i];
    51.                 gameObject2.transform.localPosition = new Vector3(0f, -0.5f, 0f);
    52.                 gameObject2.transform.localEulerAngles = Vector3.zero;
    53.             }
    54.         }
    55.         Translator translator = new Translator();
    56.         if (PlayerPrefs.GetInt("Language") > 0)
    57.         {
    58.             this.waveText = translator.Translate(115, "MP");
    59.             this.complete = translator.Translate(118, "MP");
    60.             this.timeuntilnextwave = translator.Translate(63, "MP");
    61.         }
    62.     }
    63.  
    64.     private void FixedUpdate()
    65.     {
    66.         this.npcCount = GameObject.FindGameObjectsWithTag("team2");
    67.         if (PhotonNetwork.isMasterClient)
    68.         {
    69.             if (this.oldWave != this.curWave)
    70.             {
    71.                 base.StartCoroutine(this.WaveStatus());
    72.                 this.oldWave = this.curWave;
    73.                 base.photonView.RPC("SyncWave", PhotonTargets.All, new object[]
    74.                 {
    75.                     this.curWave
    76.                 });
    77.             }
    78.             GameObject[] array = GameObject.FindGameObjectsWithTag("team1");
    79.             if (array.Length < 1 && !this.isrestarting)
    80.             {
    81.                 base.photonView.RPC("GameOver", PhotonTargets.All, new object[0]);
    82.                 this.isrestarting = true;
    83.             }
    84.         }
    85.         if (this.isOutside)
    86.         {
    87.             if (this.npcRemaining < 1)
    88.             {
    89.                 this.helicopter.transform.position = Vector3.Lerp(this.helicopter.transform.position, this.shopPoints[this.shopID].position + Vector3.up * 2.5f, 0.75f * Time.smoothDeltaTime);
    90.                 Quaternion b = Quaternion.LookRotation(this.shopPoints[this.shopID].position - this.helicopter.transform.position);
    91.                 if (Vector3.Distance(this.helicopter.transform.position, this.shopPoints[this.shopID].position) > 10f)
    92.                 {
    93.                     this.helicopter.transform.rotation = Quaternion.Slerp(this.helicopter.transform.rotation, b, 1f * Time.deltaTime);
    94.                     this.shop.allowShop = false;
    95.                 }
    96.                 else
    97.                 {
    98.                     if (this.shop.playerWeapons != null)
    99.                     {
    100.                         if (Vector3.Distance(this.shopPoints[this.shopID].position, this.shop.playerWeapons.transform.position) < 7f)
    101.                         {
    102.                             this.shop.allowShop = true;
    103.                         }
    104.                         else
    105.                         {
    106.                             this.shop.allowShop = false;
    107.                         }
    108.                     }
    109.                     this.helicopter.GetComponent<Collider>().enabled = true;
    110.                 }
    111.                 this.helicopter.transform.localEulerAngles = new Vector3(0f, this.helicopter.transform.localEulerAngles.y, 0f);
    112.             }
    113.             else
    114.             {
    115.                 this.helicopter.transform.position = Vector3.Lerp(this.helicopter.transform.position, new Vector3(this.helicopter.transform.position.x, 250f, this.helicopter.transform.position.z), 0.05f * Time.smoothDeltaTime);
    116.                 this.helicopter.GetComponent<Collider>().enabled = false;
    117.                 this.shop.allowShop = false;
    118.             }
    119.         }
    120.         else if (this.npcRemaining < 1)
    121.         {
    122.             if (this.shop.playerWeapons != null)
    123.             {
    124.                 if (Vector3.Distance(this.shopPoints[this.shopID].position, this.shop.playerWeapons.transform.position) < 4f)
    125.                 {
    126.                     this.shop.allowShop = true;
    127.                 }
    128.                 else
    129.                 {
    130.                     this.shop.allowShop = false;
    131.                 }
    132.             }
    133.             Animation component = this.shopPoints[this.shopID].transform.Find("SupplyCrate").GetComponent<Animation>();
    134.             component.Play("open");
    135.         }
    136.         else
    137.         {
    138.             this.shop.allowShop = false;
    139.             for (int i = 0; i < this.shopPoints.Length; i++)
    140.             {
    141.                 Animation component2 = this.shopPoints[i].transform.Find("SupplyCrate").GetComponent<Animation>();
    142.                 component2.Play("close");
    143.             }
    144.         }
    145.         if (this.audioSource.clip != this.waves[this.curWave].music && this.npcRemaining > 0 && !this.switchingClip)
    146.         {
    147.             if (this.curWave >= this.waves.Count - 1)
    148.             {
    149.                 base.StartCoroutine(this.SwitchClip(this.waves[this.curWave].music, 0.5f));
    150.             }
    151.             else
    152.             {
    153.                 base.StartCoroutine(this.SwitchClip(this.waves[this.curWave].music, 0.2f));
    154.             }
    155.         }
    156.         if (this.audioSource.clip != this.waves[0].music && this.npcRemaining <= 0 && !this.switchingClip)
    157.         {
    158.             base.StartCoroutine(this.SwitchClip(this.waves[0].music, this.originalVolume));
    159.         }
    160.         this.realMaxNPC = this.maxNPC + PhotonNetwork.playerList.Length / 2;
    161.     }
    162.  
    163.     private IEnumerator SwitchClip(AudioClip newClip, float newVolume)
    164.     {
    165.         this.switchingClip = true;
    166.         while (this.audioSource.volume != 0f)
    167.         {
    168.             this.audioSource.volume -= 1f * Time.deltaTime;
    169.             yield return null;
    170.         }
    171.         this.audioSource.clip = newClip;
    172.         this.audioSource.Play();
    173.         while (this.audioSource.volume < newVolume)
    174.         {
    175.             this.audioSource.volume += newVolume * Time.deltaTime;
    176.             yield return null;
    177.         }
    178.         this.audioSource.volume = newVolume;
    179.         this.switchingClip = false;
    180.         yield break;
    181.     }
    182.  
    183.     private void OnGUI()
    184.     {
    185.         GUI.skin = this.guiSkin;
    186.         GUI.backgroundColor = Color.red;
    187.         if (this.npcRemaining > 0)
    188.         {
    189.             GUIStyle guistyle = new GUIStyle();
    190.             guistyle = GUI.skin.GetStyle("Label");
    191.             guistyle.name = "Label2";
    192.             guistyle.alignment = TextAnchor.MiddleCenter;
    193.             this.DrawOutline(new Rect(0f, 10f, (float)Screen.width, 30f), string.Concat(new string[]
    194.             {
    195.                 "<size=25>",
    196.                 this.waveText,
    197.                 string.Empty,
    198.                 (this.curWave + 1).ToString(),
    199.                 "</size>"
    200.             }), 1, guistyle);
    201.             GUI.Label(new Rect(0f, 10f, (float)Screen.width, 30f), string.Concat(new string[]
    202.             {
    203.                 "<size=25><color=#b50000>",
    204.                 this.waveText,
    205.                 string.Empty,
    206.                 (this.curWave + 1).ToString(),
    207.                 "</color></size>"
    208.             }), guistyle);
    209.             guistyle.alignment = TextAnchor.MiddleLeft;
    210.             GUI.DrawTexture(new Rect((float)(Screen.width / 2 - 35), 32f, 30f, 30f), this.infectedIcon);
    211.             this.DrawOutline(new Rect((float)(Screen.width / 2), 35f, 90f, 30f), "<size=25>" + this.npcRemaining.ToString() + "</size>", 1, guistyle);
    212.             guistyle.alignment = TextAnchor.MiddleCenter;
    213.         }
    214.         else
    215.         {
    216.             string text = this.timeRemaining.ToString();
    217.             if (this.timeRemaining == 0)
    218.             {
    219.                 text = "-";
    220.             }
    221.             GUI.Label(new Rect(25f, 0f, 90f, 60f), "<size=15><color=red>" + this.complete + "</color></size>");
    222.             GUI.Label(new Rect(25f, 35f, 90f, 60f), string.Concat(new string[]
    223.             {
    224.                 "<size=15>",
    225.                 this.timeuntilnextwave,
    226.                 ";\n",
    227.                 text,
    228.                 "</size>"
    229.             }));
    230.         }
    231.         if (this.shop.playerWeapons != null && Camera.main)
    232.         {
    233.             Vector3 vector = Camera.main.WorldToScreenPoint(this.shopPoints[this.shopID].position + Vector3.up);
    234.             float num;
    235.             if (vector.z * 3f < 50f)
    236.             {
    237.                 num = vector.z * 3f;
    238.             }
    239.             else
    240.             {
    241.                 num = 50f;
    242.             }
    243.             if (vector.z > 0f)
    244.             {
    245.                 float num2 = Vector3.Distance(this.shop.playerWeapons.transform.position, this.shopPoints[this.shopID].position);
    246.                 GUI.color = new Color(0f, 0f, 0f, 0.5f);
    247.                 GUI.Label(new Rect(vector.x - 101f, (float)Screen.height - vector.y - 4f - num, 200f, 30f), "(" + ((int)num2).ToString() + "mm)");
    248.                 GUI.color = Color.white;
    249.                 GUI.Label(new Rect(vector.x - 100f, (float)Screen.height - vector.y - 5f - num, 200f, 30f), "(" + ((int)num2).ToString() + "mm)");
    250.                 GUI.DrawTexture(new Rect(vector.x - 13f, (float)Screen.height - vector.y - 5f - num + 30f, 26f, 23f), this.arrowTexture);
    251.             }
    252.         }
    253.     }
    254.  
    255.     private void DrawOutline(Rect r, string t, int strength, GUIStyle style)
    256.     {
    257.         GUI.color = new Color(0f, 0f, 0f, 1f);
    258.         for (int i = -strength; i <= strength; i++)
    259.         {
    260.             GUI.Label(new Rect(r.x - (float)strength, r.y + (float)i, r.width, r.height), t, style);
    261.             GUI.Label(new Rect(r.x + (float)strength, r.y + (float)i, r.width, r.height), t, style);
    262.         }
    263.         for (int i = -strength + 1; i <= strength - 1; i++)
    264.         {
    265.             GUI.Label(new Rect(r.x + (float)i, r.y - (float)strength, r.width, r.height), t, style);
    266.             GUI.Label(new Rect(r.x + (float)i, r.y + (float)strength, r.width, r.height), t, style);
    267.         }
    268.         GUI.color = new Color(1f, 1f, 1f, 1f);
    269.         GUI.Label(new Rect(r.x, r.y, r.width, r.height), t, style);
    270.     }
    271.  
    272.     public void Restart()
    273.     {
    274.         if (PhotonNetwork.isMasterClient)
    275.         {
    276.             for (int i = 0; i < this.npcCount.Length; i++)
    277.             {
    278.                 PhotonNetwork.Destroy(this.npcCount[i].transform.parent.gameObject);
    279.             }
    280.         }
    281.         this.curWave = 0;
    282.         this.oldWave = -1;
    283.         this.isrestarting = false;
    284.     }
    285.  
    286.     private IEnumerator WaveStatus()
    287.     {
    288.         this.shopID = UnityEngine.Random.Range(0, this.shopPoints.Length);
    289.         if (PhotonNetwork.isMasterClient)
    290.         {
    291.             base.photonView.RPC("SyncShopID", PhotonTargets.All, new object[]
    292.             {
    293.                 this.shopID
    294.             });
    295.         }
    296.         float playerMultiplier = (float)PhotonNetwork.playerList.Length;
    297.         int totalNPC2 = this.waves[this.curWave].totalCount;
    298.         if (playerMultiplier > 1f && totalNPC2 > 4)
    299.         {
    300.             totalNPC2 = (int)((float)this.waves[this.curWave].totalCount * (1f + playerMultiplier / 3f));
    301.         }
    302.         this.npcRemaining += totalNPC2;
    303.         if (PhotonNetwork.isMasterClient)
    304.         {
    305.             base.photonView.RPC("SyncNPCCount", PhotonTargets.All, new object[]
    306.             {
    307.                 this.npcRemaining
    308.             });
    309.         }
    310.         this.npcCount = GameObject.FindGameObjectsWithTag("team2");
    311.         while (this.npcRemaining > 0)
    312.         {
    313.             for (int i = 0; i < this.npcRemaining; i++)
    314.             {
    315.                 while (GameObject.FindGameObjectsWithTag("team2").Length >= this.realMaxNPC)
    316.                 {
    317.                     yield return null;
    318.                 }
    319.                 if (PhotonNetwork.isMasterClient && this.npcCount.Length < this.npcRemaining)
    320.                 {
    321.                     Transform spawnPosition = base.GetComponent<RoomMultiplayerMenu>().team_2.spawnPoints[UnityEngine.Random.Range(0, base.GetComponent<RoomMultiplayerMenu>().team_2.spawnPoints)];
    322.                     string npcName = this.waves[this.curWave].defaultNPC;
    323.                     for (int j = 0; j < this.waves[this.curWave].NPC.Length; j++)
    324.                     {
    325.                         if (this.waves[this.curWave].NPC[j].isBoss && !this.waves[this.curWave].NPC[j].bossHasSpawned && this.npcRemaining <= this.realMaxNPC)
    326.                         {
    327.                             npcName = this.waves[this.curWave].NPC[j].npcName;
    328.                             this.waves[this.curWave].NPC[j].bossHasSpawned = true;
    329.                         }
    330.                         else if (UnityEngine.Random.Range(0, this.waves[this.curWave].NPC[j].spawnChance) == 0 && !this.waves[this.curWave].NPC[j].isBoss)
    331.                         {
    332.                             npcName = this.waves[this.curWave].NPC[j].npcName;
    333.                         }
    334.                     }
    335.                     yield return new WaitForSeconds(0.1f);
    336.                     PhotonNetwork.InstantiateSceneObject("SUR/" + npcName, spawnPosition.position, spawnPosition.rotation, 0, null);
    337.                 }
    338.                 this.npcCount = GameObject.FindGameObjectsWithTag("team2");
    339.             }
    340.             yield return new WaitForEndOfFrame();
    341.         }
    342.         this.npcCount = GameObject.FindGameObjectsWithTag("team2");
    343.         while (this.npcCount.Length > 0)
    344.         {
    345.             yield return new WaitForSeconds(1f);
    346.             this.npcCount = GameObject.FindGameObjectsWithTag("team2");
    347.         }
    348.         yield return new WaitForSeconds(1f);
    349.         if (this.curWave < this.waves.Count - 1)
    350.         {
    351.             this.timeRemaining = 45;
    352.             if (PhotonNetwork.isMasterClient && this.curWave < this.waves.Count)
    353.             {
    354.                 base.photonView.RPC("RespawnPlayers", PhotonTargets.All, new object[0]);
    355.                 this.waveComplete = true;
    356.                 while (this.timeRemaining > 0)
    357.                 {
    358.                     this.timeRemaining--;
    359.                     base.photonView.RPC("SyncTime", PhotonTargets.All, new object[]
    360.                     {
    361.                         this.timeRemaining
    362.                     });
    363.                     yield return new WaitForSeconds(1f);
    364.                 }
    365.                 this.waveComplete = false;
    366.             }
    367.             UnityEngine.MonoBehaviour.print("Wave complete");
    368.             while (this.waveComplete)
    369.             {
    370.                 yield return new WaitForEndOfFrame();
    371.             }
    372.         }
    373.         if (this.curWave < this.waves.Count - 1)
    374.         {
    375.             this.curWave++;
    376.         }
    377.         else
    378.         {
    379.             base.photonView.RPC("Win", PhotonTargets.All, new object[0]);
    380.         }
    381.         yield break;
    382.     }
    383.  
    384.     [PunRPC]
    385.     private void SyncTime(int curTimeSync)
    386.     {
    387.         if (base.photonView.isMine)
    388.         {
    389.             curTimeSync = this.timeRemaining;
    390.         }
    391.         this.timeRemaining = curTimeSync;
    392.     }
    393.  
    394.     [PunRPC]
    395.     private void SyncShopID(int curIDSync)
    396.     {
    397.         if (base.photonView.isMine)
    398.         {
    399.             curIDSync = this.shopID;
    400.         }
    401.         this.shopID = curIDSync;
    402.     }
    403.  
    404.     [PunRPC]
    405.     private void SyncWave(int curWaveSync)
    406.     {
    407.         if (base.photonView.isMine)
    408.         {
    409.             curWaveSync = this.curWave;
    410.         }
    411.         this.curWave = curWaveSync;
    412.         this.oldWave = curWaveSync;
    413.     }
    414.  
    415.     [PunRPC]
    416.     private void GameOver()
    417.     {
    418.         base.StopAllCoroutines();
    419.         this.npcRemaining = 0;
    420.         base.GetComponent<RoomMultiplayerMenu>().survivalWin = false;
    421.         base.GetComponent<RoomMultiplayerMenu>().StartCoroutine(base.GetComponent<RoomMultiplayerMenu>().RoundEnded());
    422.     }
    423.  
    424.     [PunRPC]
    425.     private void Win()
    426.     {
    427.         base.GetComponent<RoomMultiplayerMenu>().survivalWin = true;
    428.         base.GetComponent<RoomMultiplayerMenu>().StartCoroutine(base.GetComponent<RoomMultiplayerMenu>().RoundEnded());
    429.     }
    430.  
    431.     private void NPCDeath()
    432.     {
    433.         if (this.npcRemaining > 0)
    434.         {
    435.             this.npcRemaining--;
    436.         }
    437.         else
    438.         {
    439.             this.npcRemaining = 0;
    440.         }
    441.         if (PhotonNetwork.isMasterClient)
    442.         {
    443.             base.photonView.RPC("SyncNPCCount", PhotonTargets.All, new object[]
    444.             {
    445.                 this.npcRemaining
    446.             });
    447.         }
    448.     }
    449.  
    450.     public void SyncAllNow(PhotonPlayer otherPlayer)
    451.     {
    452.         base.photonView.RPC("SyncWave", otherPlayer, new object[]
    453.         {
    454.             this.curWave
    455.         });
    456.         base.photonView.RPC("SyncNPCCount", otherPlayer, new object[]
    457.         {
    458.             this.npcRemaining
    459.         });
    460.         base.photonView.RPC("SyncShopID", otherPlayer, new object[]
    461.         {
    462.             this.shopID
    463.         });
    464.     }
    465.  
    466.     [PunRPC]
    467.     private void SyncNPCCount(int curSync)
    468.     {
    469.         if (base.photonView.isMine)
    470.         {
    471.             curSync = this.npcRemaining;
    472.         }
    473.         this.npcRemaining = curSync;
    474.     }
    475.  
    476.     public int curWave;
    477.  
    478.     public List<SurvivalMechanics.waveInfo> waves;
    479.  
    480.     public SurvivalMechanics.waveInfo bossWave;
    481.  
    482.     private int maxNPC = 15;
    483.  
    484.     private bool waveComplete;
    485.  
    486.     public ShopSystem shop;
    487.  
    488.     private GameObject[] npcCount;
    489.  
    490.     private int npcRemaining;
    491.  
    492.     public GUISkin guiSkin;
    493.  
    494.     public bool isOutside;
    495.  
    496.     public Transform[] shopPoints;
    497.  
    498.     private GameObject helicopter;
    499.  
    500.     public int shopID;
    501.  
    502.     public Texture2D arrowTexture;
    503.  
    504.     public bool largeMap;
    505.  
    506.     private AudioSource audioSource;
    507.  
    508.     private float originalVolume;
    509.  
    510.     private string waveText = "Wave ";
    511.  
    512.     private string timeuntilnextwave = "Time until next wave";
    513.  
    514.     private string complete = "Complete";
    515.  
    516.     private ObscuredInt realMaxNPC;
    517.  
    518.     private bool switchingClip;
    519.  
    520.     public Texture2D infectedIcon;
    521.  
    522.     private bool isrestarting;
    523.  
    524.     private int oldWave = -1;
    525.  
    526.     private int timeRemaining = 45;
    527.  
    528.     [Serializable]
    529.     public class waveInfo
    530.     {
    531.         public int totalCount = 5;
    532.  
    533.         public string defaultNPC = "Newborn_Bot";
    534.  
    535.         public SurvivalMechanics.specialNPC[] NPC;
    536.  
    537.         public AudioClip music;
    538.     }
    539.  
    540.     [Serializable]
    541.     public class specialNPC
    542.     {
    543.         public string npcName;
    544.  
    545.         public int spawnChance;
    546.  
    547.         public int maxSpawn;
    548.  
    549.         public bool isBoss;
    550.  
    551.         [HideInInspector]
    552.         public bool bossHasSpawned;
    553.     }
    554. }
    555.  

    I get the error at line 321

    Code (CSharp):
    1.                     Transform spawnPosition = base.GetComponent<RoomMultiplayerMenu>().team_2.spawnPoints[UnityEngine.Random.Range(0, base.GetComponent<RoomMultiplayerMenu>().team_2.spawnPoints)];
    2.  
     
  2. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    178
    Post the full errors.

    What datatype is spawnPoints and are you sure it isn't null?
     
  3. monstergrunt09

    monstergrunt09

    Joined:
    Aug 15, 2018
    Posts:
    58
    The errors bring me to line 321, And im not sure it isnt null
     
  4. monstergrunt09

    monstergrunt09

    Joined:
    Aug 15, 2018
    Posts:
    58
    And here are the full errors

    SurvivalMechanics.cs(321,126): error CS1502: The best overloaded method match for `UnityEngine.Random.Range(float, float)' has some invalid arguments

    SurvivalMechanics.cs(321,183): error CS1503: Argument `#2' cannot convert `System.Collections.Generic.List<UnityEngine.Transform>' expression to type `float'
     
  5. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    178
    Try changing to this:

    Code (CSharp):
    1. Transform spawnPosition = base.GetComponent<RoomMultiplayerMenu>().team_2.spawnPoints[UnityEngine.Random.Range(0, base.GetComponent<RoomMultiplayerMenu>().team_2.spawnPoints.Count() - 1)];
     
  6. monstergrunt09

    monstergrunt09

    Joined:
    Aug 15, 2018
    Posts:
    58

    I changed it and i get this error.

    SurvivalMechanics.cs(321,180): error CS1955: The member `System.Collections.Generic.List<UnityEngine.Transform>.Count' cannot be used as method or delegate
     
  7. monstergrunt09

    monstergrunt09

    Joined:
    Aug 15, 2018
    Posts:
    58
    I edited it and i get the same errors of before.Here are the errors

    SurvivalMechanics.cs(321,168): error CS1503: Argument `#2' cannot convert `System.Collections.Generic.List<UnityEngine.Transform>' expression to type `float'


    SurvivalMechanics.cs(321,111): error CS1502: The best overloaded method match for `UnityEngine.Random.Range(float, float)' has some invalid arguments


    I don't see any errors.
     

    Attached Files:

  8. monstergrunt09

    monstergrunt09

    Joined:
    Aug 15, 2018
    Posts:
    58
    And when i put your edited line i get this error.

    SurvivalMechanics.cs(321,180): error CS1955: The member `System.Collections.Generic.List<UnityEngine.Transform>.Count' cannot be used as method or delegate


    Only
    Count
    is an error. Look.
     

    Attached Files:

  9. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    789
    If you take @nilsdr's code and just remove the parenthesis from the .Count call it should work. Count is not a function.

    EDIT:

    You also do not need the -1!
     
  10. monstergrunt09

    monstergrunt09

    Joined:
    Aug 15, 2018
    Posts:
    58
    Thanks dude! It works perfectly now!