void LoadCircleAnchorPoints() { string filePath = TrackingToolsConstants.circleAnchorsDirectoryPath + "/" + _circleAnchorPointsFileName + ".json"; if (!File.Exists(filePath)) { return; } string json = File.ReadAllText(filePath); CircleAnchorData data = JsonUtility.FromJson <CircleAnchorData>(json); for (int p = 0; p < pointCount; p++) { SetAnchoredPosition(_userPointRects[p], data.points[p]); } _dirtyPoints = true; }
void SaveCircleAnchorPoints() { if (!Directory.Exists(TrackingToolsConstants.circleAnchorsDirectoryPath)) { Directory.CreateDirectory(TrackingToolsConstants.circleAnchorsDirectoryPath); } string filePath = TrackingToolsConstants.circleAnchorsDirectoryPath + "/" + _circleAnchorPointsFileName + ".json"; CircleAnchorData data = new CircleAnchorData(); for (int p = 0; p < pointCount; p++) { data.points[p] = _userPointRects[p].anchorMin; } File.WriteAllText(filePath, JsonUtility.ToJson(data)); //Debug.Log( logPrepend + "Saved anchor points to file.\n" + filePath ); }