hey man,
in AddToCache() method u are getting a component in a parent of Ore (GetComponentInParent), i wonder why?
any ore spawned in the World doesnt have parent, its ok, unity will give correct answer, but if we spawn it with some parenting - we would get an error.
else if (trackOre && entity is OreResourceEntity)
{
if (!cache.Ores.ContainsKey(position))
{
float amount = 0;
foreach (var item in entity.GetComponentInParent<ResourceDispenser>().containedItems)
{
amount += item.amount;
}
cache.Ores.Add(position, new CachedInfo { Name = _(entity.ShortPrefabName), Info = amount });
return True;
}
return False;
}