简介
public GameObject friendprefab; void Start() { InvokeRepeating("Createfriend", 0.1f, 1f); } void Createfriend() { float x = 10.5f; float y = Random.Range(-3f, 2.5f); GameObject friend = Instantiate(friendprefab); friend.transform.position = new Vector3(x, y, 0); }