I have these codes for my item database, it works on pc, but doesn’t work on my android phone
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LitJson;
using System.IO;
public class ItemDatabase : MonoBehaviour
{
private List<Weapon> WeaponDatabase = new List<Weapon>();
private List<Armor> ArmorDatabase = new List<Armor>();
private List<Potion> PotionDatabase = new List<Potion>();
private JsonData WeaponData, ArmorData, PotionData;
void Start()
{
WeaponData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/Scripts/Weapons.json"));
ArmorData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/Scripts/Armors.json"));
PotionData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/Scripts/Potions.json"));
ConstructItemDatabase();
}
public Weapon FetchWeaponbyID(int id)
{
for (int i = 0; i < WeaponDatabase.Count; i++)
{
if (WeaponDatabase*.ID == id)*
{
return WeaponDatabase*;*
}
}
return null;
}
public Armor FetchArmorbyID(int id)
{
for (int i = 0; i < ArmorDatabase.Count; i++)
{
if (ArmorDatabase*.ID == id)*
{
return ArmorDatabase*;*
}
}
return null;
}
public Potion FetchPotionbyID(int id)
{
for (int i = 0; i < PotionDatabase.Count; i++)
{
if (PotionDatabase*.ID == id)*
{
return PotionDatabase*;*
}
}
return null;
}
void ConstructItemDatabase()
{
for (int x = 0; x < WeaponData.Count; x++)
{
WeaponDatabase.Add(new Weapon((int)WeaponData[x][“ID”], WeaponData[x][“ItemName”].ToString(),
(int)WeaponData[x][“Damage”], (bool)WeaponData[x][“Stackable”], (bool)WeaponData[x][“Equipable”],
WeaponData[x][“Slug”].ToString(), WeaponData[x][“Description”].ToString()));
}
for (int x = 0; x < ArmorData.Count; x++)
{
ArmorDatabase.Add(new Armor((int)ArmorData[x][“ID”], ArmorData[x][“ItemName”].ToString(),
(int)ArmorData[x][“MaxHealth”], (bool)ArmorData[x][“Stackable”], (bool)ArmorData[x][“Equipable”],
ArmorData[x][“Slug”].ToString(), ArmorData[x][“Description”].ToString()));
}
for (int x = 0; x < PotionData.Count; x++)
{
PotionDatabase.Add(new Potion((int)PotionData[x][“ID”], PotionData[x][“ItemName”].ToString(),
(int)PotionData[x][“HealAmount”], (bool)PotionData[x][“Stackable”], (bool)PotionData[x][“Equipable”],
PotionData[x][“Slug”].ToString(), PotionData[x][“Description”].ToString()));
}
}
public class Weapon
{
public int ID { get; set; }
public string ItemName { get; set; }
public int Damage { get; set; }
public bool Stackable { get; set; }
public bool Equipable { get; set; }
public string Description { get; set; }
public string Slug { get; set; }
public Sprite Sprite { get; set; }
public Weapon(int _id, string _itemName, int _damage, bool _stackable, bool _equipable, string _slug, string _description)
{
this.ID = _id;
this.ItemName = _itemName;
this.Stackable = _stackable;
this.Equipable = _equipable;
this.Damage = _damage;
this.Slug = _slug;
this.Description = _description;
this.Sprite = Resources.Load(“Sprites/Weapons/” + this.Slug);
}
public Weapon()
{
this.ID = -1;
}
}
public class Armor
{
public int ID { get; set; }
public string ItemName { get; set; }
public int MaxHealth { get; set; }
public bool Stackable { get; set; }
public bool Equipable { get; set; }
public string Description { get; set; }
public string Slug { get; set; }
public Sprite Sprite { get; set; }
public Armor(int _id, string _itemName, int _maxhealth, bool _stackable, bool _equipable, string _slug, string _description)
{
this.ID = _id;
this.ItemName = _itemName;
this.Stackable = _stackable;
this.Equipable = _equipable;
this.MaxHealth = _maxhealth;
this.Slug = _slug;
this.Description = _description;
this.Sprite = Resources.Load(“Sprites/Armors/” + this.Slug);
}
public Armor()
{
this.ID = -1;
}
}
public class Potion
{
public int ID { get; set; }
public string ItemName { get; set; }
public bool Stackable { get; set; }
public bool Equipable { get; set; }
public string Description { get; set; }
public string Slug { get; set; }
public int HealAmount { get; set; }
public Sprite Sprite { get; set; }
public Potion(int _id, string _itemName, int _healamount, bool _stackable, bool _equipable, string _slug, string _description)
{
this.ID = _id;
this.ItemName = _itemName;
this.Stackable = _stackable;
this.Equipable = _equipable;
this.HealAmount = _healamount;
this.Slug = _slug;
this.Description = _description;
this.Sprite = Resources.Load(“Sprites/Potions/” + this.Slug);
}
public Potion()
{
this.ID = -1;
}
}
How can I make it better, please, I need an answer. please help me.
the images for the items in the inventory are showing correctly on my pc,
but for android its null.