Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Problem with adding 1 element of an array to a list

$
0
0
well the tiltle says it here is the error i get: Assets/scripts/AddItem.js(29,28): BCE0048: Type 'System.Type' does not support slicing. here is the script where the item is what i want to add. #pragma strict import System.Collections.Generic; var Inventory : PlayerInv; var GUISKIN : GUISkin; var Weapons : WeaponInfo[]; class WeaponInfo { var GO : GameObject; var name : String; var icon : Texture2D; } function Start () { Inventory = GetComponent(PlayerInv); } function OnGUI() { GUI.skin = GUISKIN; for(var Weapon : WeaponInfo in Weapons) { GUILayout.Label(Weapon.icon, GUILayout.Width(300)); if (GUI.Button(Rect(0,0,306,156),"")) { Debug.Log("You Choose The AKS74U"); Inventory.Inv.Add(WeaponInfo[0]); } } } here is the script where i want to add it to: import System.Collections.Generic; var Inv = List.(); function Start () { } function Update () { }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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