using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class AddPoint : MonoBehaviour { /// /// /// public string pointString; /// /// /// public GameObject prefab; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } [ContextMenu("Add")] public void Add() { Debug.Log("AAA"); List point = JsonConvert.DeserializeObject>(pointString); for(int i=0;i< point.Count; i++) { double x = point[i].display_x; double y = point[i].display_y; GameObject obj = GameObject.Instantiate(prefab, transform); //obj.t.position = new Vector3((float)y, (float)x, 0); obj.GetComponent().localPosition= new Vector3((float)y, (float)x, 0); obj.transform.name = "point" + (i + 1).ToString(); obj.SetActive(true); } } }