Skip to content

Refactor Unity test scripts: culture-invariant parsing, parenting, and safety improvements - #76

Draft
cassiussa wants to merge 4 commits into
masterfrom
codex/task-title
Draft

Refactor Unity test scripts: culture-invariant parsing, parenting, and safety improvements#76
cassiussa wants to merge 4 commits into
masterfrom
codex/task-title

Conversation

@cassiussa

Copy link
Copy Markdown
Owner

Motivation

  • Improve reliability and modernize several editor/runtime test scripts by making numeric parsing culture-invariant and consolidating file I/O.
  • Reduce accidental component duplication and improve transform parenting semantics in scene construction code.
  • Harden utility types by making pure helper classes static and implementing equality/hash semantics for value types.

Description

  • Renamed and made the editor helper class static (Tags -> MakeLayers) and adjusted constructor/method visibility to static/private in MakeLayers.cs.
  • Replaced direct string double.Parse calls with a culture-invariant helper ParseDouble(JSONNode) in CreateSolarSystems.cs and updated parsing in Elements (RightAscension and Declination) to use CultureInfo.InvariantCulture.
  • Centralized JSON loading in ImportData.Data by computing FileName via Application.dataPath and adding LoadJson() which returns File.ReadAllText(FileName).
  • Replaced deprecated/less-robust parenting via transform.parent = ... with transform.SetParent(..., true) and added [DisallowMultipleComponent] to several MonoBehaviours (CreateCameras, CreateSolarSystems, SystemScaleState).
  • Made Maths a static class and removed unused usings across several files to reduce clutter.
  • Added Equals and GetHashCode implementations for Vector3d and provided an implicit cast to Vector3, and made minor API accessibility adjustments like SerializeField for camDepth and use of cam.cullingMask.
  • Other whitespace/usings cleanup and small fixes across CreateCameras.cs, CreateElements.cs, SystemScaleState.cs, and several test scripts.

Testing

  • No automated tests were executed as part of this change set.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant