void Start() { propertyNames = new List <GameObject>(); propertyValues = new List <GameObject>(); IsCancelRequested = false; var objectTag = ReferenceObject.tag; if (objectTag == "Car") { for (int i = 0; i < 6; i++) { var property = Instantiate(propertyPrefab); property.transform.SetParent(transform); property.transform.localScale = Vector3.one; propertyNames.Add(property.transform.Find("Name").gameObject); propertyValues.Add(property.transform.Find("Value").gameObject); } propertyNames[0].GetComponent <TextMeshProUGUI>().SetText("Object ID"); propertyValues[0].GetComponent <TextMeshProUGUI>().SetText(ReferenceObject.GetInstanceID().ToString()); propertyNames[1].GetComponent <TextMeshProUGUI>().SetText("Object Type"); propertyValues[1].GetComponent <TextMeshProUGUI>().SetText(ReferenceObject.tag); propertyNames[2].GetComponent <TextMeshProUGUI>().SetText("Velocity"); propertyNames[3].GetComponent <TextMeshProUGUI>().SetText("Expected velocity"); propertyNames[4].GetComponent <TextMeshProUGUI>().SetText("Accleration"); propertyNames[5].GetComponent <TextMeshProUGUI>().SetText("Max accleration"); } if (objectTag == "Lane") { var nextRoads = ReferenceObject.GetComponent <Line>().nextRoads; for (int i = 0; i < nextRoads.Count + 2; i++) { var property = Instantiate(propertyPrefab); property.transform.SetParent(transform); property.transform.localScale = Vector3.one; propertyNames.Add(property.transform.Find("Name").gameObject); propertyValues.Add(property.transform.Find("Value").gameObject); } propertyNames[0].GetComponent <TextMeshProUGUI>().SetText("Object ID"); propertyValues[0].GetComponent <TextMeshProUGUI>().SetText(ReferenceObject.GetInstanceID().ToString()); propertyNames[1].GetComponent <TextMeshProUGUI>().SetText("Object Type"); propertyValues[1].GetComponent <TextMeshProUGUI>().SetText(ReferenceObject.tag); for (int i = 2; i < nextRoads.Count + 2; i++) { propertyNames[i].GetComponent <TextMeshProUGUI>().SetText($"Next Road id [{i}]"); propertyValues[i].GetComponent <TextMeshProUGUI>().SetText(nextRoads[i - 2].gameObject.GetInstanceID().ToString()); } } var task = UpdatePropertyValue(objectTag); }