private void DrawImportButton() { SerializedLineDetectionSettings.ApplyModifiedProperties(); SerializedMeshBuilderSettings.ApplyModifiedProperties(); if (GUILayout.Button("Create")) { var parent = GameObject.Find(ParentObjectName); if (parent != null) { CoreUtils.Destroy(parent); } parent = new GameObject(ParentObjectName); switch (lineDetectionSettings.lineSource) { case LineDetectionSettings.LineSource.HdMap: { CreateLinesFromHdMap(parent); } break; case LineDetectionSettings.LineSource.IntensityMap: { LineDetector.Execute(parent.transform, lineDetectionSettings); } break; case LineDetectionSettings.LineSource.CorrectedHdMap: { LineDetector.Execute(parent.transform, lineDetectionSettings); var linesOverride = parent.GetComponent <LaneLineOverride>(); CreateLinesFromHdMap(parent, linesOverride); } break; default: throw new ArgumentOutOfRangeException(); } if (lineDetectionSettings.generateLineSensorData) { if (parent.GetComponent <LaneLineOverride>() == null) { LineDetector.Execute(parent.transform, lineDetectionSettings); } } else { var overrideData = parent.GetComponent <LaneLineOverride>(); if (overrideData != null) { CoreUtils.Destroy(overrideData); } } } }
private void SaveSettings() { if (serializedLineDetectionSettings != null) { SerializedLineDetectionSettings.ApplyModifiedProperties(); var data = JsonUtility.ToJson(lineDetectionSettings); EditorPrefs.SetString(LineDetectionSettingsKey, data); } if (serializedMeshBuilderSettings != null) { SerializedMeshBuilderSettings.ApplyModifiedProperties(); var data = JsonUtility.ToJson(meshBuilderSettings); EditorPrefs.SetString(MeshBuilderSettingsKey, data); } }