Hi guys, I’m trying to create a random loot chest but when I try to instantiate the prefab the location is always messed up, but when I tried with a new gameobject it worked fine and I can’t understand why …
here’s the code:
public GameObject Loot;
public Transform LootSpawnPoint;
int random;
private void OnCollisionEnter(Collision other)
{
random = Random.Range(0, Loot.Length);
if(other.collider.CompareTag("Player"))
{
Instantiate(Loot[random], LootSpawnPoint.transform.position, Quaternion.identity);
}
}
and a pic (he shoe is the prefab that should have spawned in the gameobject position):