I’m working on a game where you have to find a key to a closed door. But I want this key to spawn on a different location every time i play the game (otherwise the gameplay would be boring). I think the easiest thing would be to make 5 keys at different locations, disable them, and enable one of them randomly with a script at the beginning of the game. Do you guys have any scripts for that?
Set the z and x to random and y to the high you want it at. Here is an example (attach script to key): transform.position(Vector3.x = Random.value * 100); transform.position(Vector3.z = Random.value * 100);
The random.value returns between 0 and 1 so we multiply by 100 to make it larger