I have this Scriptable Object which contains a reference to a Prefab i want to send to my player inventory as an Entity so it can spawn it later.
Since the has object is sent to the inventory when the user clicks a button, this happens inside of a MonoBehaviour that handles what to do when the buttons are clicked.
Is there a way to convert this Prefab to and Entity inside this MonoBehaviour?
The code as it is:
//Inventory
public struct Inventory : IComponentData {
public NativeList<Entity> Towers;
}
//Upgrade Data
public class TowerData : ScriptableObject {
//[...]
[SerializeField] private GameObject towerPrefab;
}
//The monobehaviour
//[...]
inventorySingleton.Towers.Add(_upgradesToChooseFrom[upgradeIndex].TowerPrefab); // this needs to be an Entity
//[...]
Thanks in advance!