- Home /
This question was
closed Oct 14, 2014 at 09:53 AM by
Graham-Dunnett for the following reason:
Duplicate Question
Unity3D error: Assets/Scripts/Item.cs(25,38): error CS0308: The non-generic method `UnityEngine.Resources.Load(string)' cannot be used with the type arguments
Hello can please sombody help me i have a proble with my C# script this error shoes up every good damn time:"Assets/Scripts/Item.cs(25,38): error CS0308: The non-generic method `UnityEngine.Resources.Load(string)' cannot be used with the type arguments" Here is my code:
using UnityEngine;
using System.Collections;
[System.Serializable]
public class Item {
public string ItemName;
public int ItemID;
public string ItemDescription;
public Texture2D ItemIcon;
public int ItemPower;
public int ItemSpeed;
public itemUse ItemUse;
public enum itemUse
{
Weapon,
Consumable,
}
public Item(string Name, int ID, string Description, int Power, int Speed, itemUse Use)
{
ItemName = Name;
ItemID = ID;
ItemDescription = Description;
ItemIcon = Resources.Load<Texture2D>("Item Icons/" + Name);
ItemPower = Power;
ItemSpeed = Speed;
ItemUse = Use;
}
}
Comment
Answer by Graham-Dunnett · Oct 14, 2014 at 09:52 AM
I know this is old but I just googled this and that's such a dickish answer
"cast your type after, Resources doesn't return a generic version, eg : Resources.Load("path") as Texture2D" - not hard to help someone with one sentence. Literally only one other Resources cast question in your link.
This was the first thing when I googled my error.