using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Assertions; namespace Assets.Scenes.Ride.Scripts { public class NearByItemFactory : MonoBehaviour { private GameObject nearByItem; // Start is called before the first frame update void Start() { nearByItem = Resources.Load("UI/Prefab/Ride/NearbyItem"); Assert.IsNotNull(nearByItem); } float t = 1; // Update is called once per frame void Update() { t -= Time.deltaTime; while (t < 0) { //var nearList = MapUDPService.GetNearRiderData(1, 20, new double[] { playerController.Nextlatlong.x, playerController.Nextlatlong.y }); //Debug.Log(nearList.Count()); GameObject newObj; // Create GameObject instance for (int i = 0; i < 5; i++) { // Create new instances of our prefab until we've created as many as we specified newObj = (GameObject)Instantiate(nearByItem, transform); var nearByItemscript = newObj.GetComponent(); nearByItemscript.setName(""); nearByItemscript.setRatio(""); nearByItemscript.setSpeed(""); nearByItemscript.setHead(""); t = 1; } } } } }