how to get the x transform of an object in unity code example
Example 1: how to find object by ag unity
yourObjects = GameObject.FindGameObjectsWithTag("Respawn");
//Youtube: https://www.youtube.com/channel/UCBDHOr2HKOuMiWUj-Pu-AGA
Example 2: how to make % posibility to spawn an object C# in unity
public class RandomTimeSpawner : MonoBehaviour { //Spawn this object public GameObject spawnObject; public float maxTime = 5; public float minTime = 2; //current time private float time; //The time to spawn the object private float spawnTime; void Start(){ SetRandomTime(); time = minTime; } void FixedUpdate(){ //Counts up time += Time.deltaTime; //Check if its the right time to spawn the object if(time >= spawnTime){ SpawnObject(); SetRandomTime(); } } //Spawns the object and resets the time void SpawnObject(){ time = minTime; Instantiate (spawnObject, transform.position, spawnObject.transform.rotation); } //Sets the random time between minTime and maxTime void SetRandomTime(){ spawnTime = Random.Range(minTime, maxTime); } }