Skip to content

Commit e2e4ab5

Browse files
authored
refactor: unity integration (#17)
* refactor: unity integration (#16) * task: refactor handling of Unity integration * task: bump gitversion/setup to v3.1.1 * ci: update dotnet.yml * fix: dotnet build configuration * fix: dotnet project build configurations * task: update readme
1 parent 38442c5 commit e2e4ab5

34 files changed

Lines changed: 202 additions & 553 deletions

.assets/scripts/create-unity-package.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Set-Location (Split-Path $MyInvocation.MyCommand.Path)
1111
$solutionDir = Get-SolutionDirectory
1212
Set-Location $solutionDir
1313

14-
$fixedMathSharpPluginsPath = "$solutionDir\src\FixedMathSharp.Editor\bin\Release\net48"
14+
$fixedMathSharpPluginsPath = "$solutionDir\src\FixedMathSharp\bin\ReleaseUnity\net48"
1515
$unityProjectPath = "$solutionDir\FMS_UnityProject"
16-
$unityAssetsPath = "$unityProjectPath\Assets\FixedMathSharp"
16+
$unityAssetsPath = "$unityProjectPath\Assets\Integration\FixedMathSharp"
1717
$unityPluginsPath = "$unityAssetsPath\Plugins"
1818
$packagePath = "$solutionDir\$OutputPath"
1919

@@ -32,13 +32,13 @@ if (Test-Path $unityProjectPath) {
3232
Ensure-GitVersion-Environment $UnityVersion
3333

3434
# Build the project with the version information applied
35-
Build-Project -Configuration "Release"
35+
Build-Project -Configuration "ReleaseUnity"
3636

3737
# Copy DLLs (including PDB and XML) to Unity Plugins folder
3838
Copy-Item "$fixedMathSharpPluginsPath\*" $unityPluginsPath -Recurse -ErrorAction SilentlyContinue
3939

4040
# Copy Unity editor-specific scripts to the Assets folder
41-
Copy-Item "$solutionDir\src\FixedMathSharp.Editor\Editor" $unityAssetsPath -Recurse -ErrorAction SilentlyContinue
41+
Copy-Item "$solutionDir\src\FixedMathSharp\Integration\Unity\*" $unityAssetsPath -Recurse -ErrorAction SilentlyContinue
4242

4343
$packageName = "FixedMathSharp.$env:GitVersion_FullSemVer.unitypackage"
4444
$unityExePath = "C:\Program Files\Unity\Hub\Editor\$env:UnityVersion\Editor\Unity.exe"

.github/workflows/dotnet.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ jobs:
3737
dotnet-version: 8.0.x
3838

3939
- name: Install GitVersion
40-
uses: gittools/actions/gitversion/setup@v3.0.0
40+
uses: gittools/actions/gitversion/setup@v3.1.1
4141
with:
42-
versionSpec: '6.x'
42+
versionSpec: '6.0.x'
4343

4444
- name: Cache NuGet packages
4545
uses: actions/cache@v3

FixedMathSharp.sln

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ VisualStudioVersion = 17.5.33516.290
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FixedMathSharp", "src\FixedMathSharp\FixedMathSharp.csproj", "{61834921-141D-4BD5-9E75-31188DF32E93}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FixedMathSharp.Editor", "src\FixedMathSharp.Editor\FixedMathSharp.Editor.csproj", "{48AD1F68-9AD1-495E-B6FF-FA8A27C063A7}"
9-
ProjectSection(ProjectDependencies) = postProject
10-
{61834921-141D-4BD5-9E75-31188DF32E93} = {61834921-141D-4BD5-9E75-31188DF32E93}
11-
EndProjectSection
12-
EndProject
138
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FixedMathSharp.Tests", "tests\FixedMathSharp.Tests\FixedMathSharp.Tests.csproj", "{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}"
149
EndProject
1510
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{882324AE-67F3-4F5B-8485-6EF324A15CBF}"
@@ -21,21 +16,27 @@ EndProject
2116
Global
2217
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2318
Debug|Any CPU = Debug|Any CPU
19+
DebugUnity|Any CPU = DebugUnity|Any CPU
2420
Release|Any CPU = Release|Any CPU
21+
ReleaseUnity|Any CPU = ReleaseUnity|Any CPU
2522
EndGlobalSection
2623
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2724
{61834921-141D-4BD5-9E75-31188DF32E93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2825
{61834921-141D-4BD5-9E75-31188DF32E93}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugUnity|Any CPU.ActiveCfg = DebugUnity|Any CPU
27+
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugUnity|Any CPU.Build.0 = DebugUnity|Any CPU
2928
{61834921-141D-4BD5-9E75-31188DF32E93}.Release|Any CPU.ActiveCfg = Release|Any CPU
3029
{61834921-141D-4BD5-9E75-31188DF32E93}.Release|Any CPU.Build.0 = Release|Any CPU
31-
{48AD1F68-9AD1-495E-B6FF-FA8A27C063A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32-
{48AD1F68-9AD1-495E-B6FF-FA8A27C063A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
33-
{48AD1F68-9AD1-495E-B6FF-FA8A27C063A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
34-
{48AD1F68-9AD1-495E-B6FF-FA8A27C063A7}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseUnity|Any CPU.ActiveCfg = ReleaseUnity|Any CPU
31+
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseUnity|Any CPU.Build.0 = ReleaseUnity|Any CPU
3532
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3633
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugUnity|Any CPU.ActiveCfg = DebugUnity|Any CPU
35+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugUnity|Any CPU.Build.0 = DebugUnity|Any CPU
3736
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
3837
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseUnity|Any CPU.ActiveCfg = ReleaseUnity|Any CPU
39+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseUnity|Any CPU.Build.0 = ReleaseUnity|Any CPU
3940
EndGlobalSection
4041
GlobalSection(SolutionProperties) = preSolution
4142
HideSolutionNode = FALSE

README.md

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,42 @@ Ideal for simulations, games, and physics engines requiring reliable arithmetic
2424

2525
## 🚀 Installation
2626

27-
### Via NuGet:
28-
```bash
29-
dotnet add package FixedMathSharp
30-
```
3127

32-
### Testing Locally:
33-
1. Build the package:
34-
```bash
35-
dotnet pack --configuration Release
36-
```
37-
2. Create a local NuGet source and test it:
38-
```bash
39-
mkdir ./LocalNuGet
40-
cp ./bin/Release/*.nupkg ./LocalNuGet/
41-
dotnet nuget add source ./LocalNuGet --name LocalNuGet
42-
dotnet add package FixedMathSharp --source ./LocalNuGet
43-
```
28+
Clone the repository and add it to your project:
29+
30+
### Non-Unity Projects
31+
32+
1. **Install via NuGet**:
33+
- Add FixedMathSharp to your project using the following command:
34+
35+
```bash
36+
dotnet add package FixedMathSharp
37+
```
38+
39+
2. **Or Download/Clone**:
40+
- Clone the repository or download the source code.
41+
42+
```bash
43+
git clone https://github.com/mrdav30/FixedMathSharp.git
44+
```
45+
46+
3. **Add to Project**:
47+
48+
- Include the FixedMathSharp project or its DLLs in your build process.
49+
50+
### Unity
51+
52+
To integrate **FixedMathSharp** into your Unity project:
53+
54+
1. **Download the Package**:
55+
- Obtain the latest `FixedMathSharp{{VERSION}}.unitypackage` from the [Releases](https://github.com/mrdav30/FixedMathSharp/releases) section of the repository.
56+
57+
2. **Import into Unity**:
58+
- In Unity, navigate to **Assets > Import Package > Custom Package...**.
59+
- Select the downloaded `FixedMathSharp{{VERSION}}.unitypackage` file.
60+
61+
3. **Verify the Integration**:
62+
- After importing, confirm that the `FixedMathSharp` namespace is accessible in your scripts.
4463

4564
---
4665

src/FixedMathSharp.Editor/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/FixedMathSharp.Editor/Editor/Utilities/PropertyPathComponent.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/FixedMathSharp.Editor/FixedMathSharp.Editor.csproj

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/FixedMathSharp.Editor/Utilities/FixedMathEditorUtility.cs

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/FixedMathSharp.Editor/Utilities/PropertyPathComponent.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)