string CoordinateToJson() { Vector2 screenPos = rectTransform2ScreenPoint(GetComponent <RectTransform>()); CoordinateSerializable coord = new CoordinateSerializable { x = (int)Mathf.Round(screenPos.x), y = (int)Mathf.Round(screenPos.y), name = SceneManager.GetActiveScene().name + "." + name, time = Time.time, type = GetType().ToString(), }; return(JsonUtility.ToJson(coord)); }
string CoordinateToJson() { Vector2 screenPos = rectTransform2ScreenPoint(GetComponent <RectTransform>()); CoordinateSerializable coord = new CoordinateSerializable { x = (int)Mathf.Round(screenPos.x), y = (int)Mathf.Round(screenPos.y), deviceY = (int)Mathf.Round(Screen.height - screenPos.y), name = name, time = Time.time, type = GetType().ToString(), }; return(JsonUtility.ToJson(coord)); }
private string CoordinateToJson(Camera camera) { Vector3 screenPos = camera.WorldToScreenPoint(transform.position); CoordinateSerializable coord = new CoordinateSerializable { x = (int)Mathf.Round(screenPos.x), y = (int)Mathf.Round(screenPos.y), name = SceneManager.GetActiveScene().name + "." + name, time = Time.time, type = GetType().ToString(), }; return(JsonUtility.ToJson(coord)); }
private string CoordinateToJson(Camera camera) { Vector3 screenPos = camera.WorldToScreenPoint(transform.position); CoordinateSerializable coord = new CoordinateSerializable { x = (int)Mathf.Round(screenPos.x), y = (int)Mathf.Round(screenPos.y), deviceY = (int)Mathf.Round(Screen.height - screenPos.y), name = name, time = Time.time, type = GetType().ToString(), }; return(JsonUtility.ToJson(coord)); }