A few days ago I moved over to unity 5 and I made script accordig to the old unity version and I got these erros I can’t let unity adjust it himself so can somebody help because I don’t know what is wrong the erros is in the line from OnGUI so the line that contains CurWeapon = GUILAYOUT.SelectionGrid and so on. I get the erros: CS1502 & CS1503 & CS1061. The script is actually of a YouTube called the facegrabber so maybe more people have this problem
CS1061 - Assets/scripts/WeaponManager.cs(24,76): error CS1061: Type System.Collections.Generic.List' does not contain a definition for
toArray’ and no extension method toArray' of type
System.Collections.Generic.List’ could be found (are you missing a using directive or an assembly reference?)
Cs1502 - Assets/scripts/WeaponManager.cs(24,39): error CS1502: The best overloaded method match for `UnityEngine.GUILayout.SelectionGrid(int, string, int, params UnityEngine.GUILayoutOption)’ has some invalid arguments
Cs1503 - Assets/scripts/WeaponManager.cs(24,39): error CS1503: Argument #2' cannot convert
object’ expression to type `string’
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class WeaponManager : MonoBehaviour {
public List<Gun> Weapons = new List<Gun>();
public List<string> WeaponNames = new List<string>();
public int CurWeapon;
public static WeaponManager Instance;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
CurWeapon = GUILayout.SelectionGrid(CurWeapon, WeaponNames.toArray(), 4);
}
public static Gun FindWeapon(string Name)
{
foreach (Gun Gu in Instance.Weapons) {
if(Name == Gu.Name)
return Gu;
}
return null;
}