Skip to content

Unity

Getting Started with Unity

Adding Dependencies:

  • Manual Setup: This section guides you through adding Unity dependencies directly to your project's build.gradle files. (Link to Manual Dependency Setup Section)
  • Version Catalog (Recommended): For a more streamlined approach, consider integrating a version catalog. This allows for centralized version management and easier updates. (Link to Version Catalog Section)

Note: If you prefer manual dependency setup, follow the instructions in the "Manual Setup" section. Otherwise, jump to the "Version Catalog" section for centralized management.

For information on using the KAPT plugin, see the KAPT documentation.
For information on using the KSP plugin, see the KSP quick-start documentation.
For more information about dependencies, see Add Build Dependencies.

Adding Unity Dependencies Manually

To use Unity in your app, add the following dependencies to your app's build.gradle file:

build.gradle
dependencies {
    def teogorDrifterUnity = "1.0.0-alpha01"

    implementation "dev.teogor.drifter:drifter-unity-common:$teogorDrifterUnity"
    implementation "dev.teogor.drifter:drifter-unity-2022-3-7f1:$teogorDrifterUnity"
}
build.gradle.kts
dependencies {
    val teogorDrifterUnity = "1.0.0-alpha01"

    implementation("dev.teogor.drifter:drifter-unity-common:$teogorDrifterUnity")
    implementation("dev.teogor.drifter:drifter-unity-2022-3-7f1:$teogorDrifterUnity")
}

This section guides you through utilizing a version catalog for centralized management of Unity dependencies in your project. This approach simplifies updates and ensures consistency.

First, define the dependencies in the libs.versions.toml file:

  • Group-Name Based: This approach is used for declaring libraries referenced by group and artifact name.
  • Module Based: This approach is used for declaring libraries referenced by their module.
gradle/libs.versions.toml
[versions]
teogor-drifter-unity = "1.0.0-alpha01"

[libraries]
teogor-drifter-unity-common = { group = "dev.teogor.drifter", name = "drifter-unity-common", version.ref = "teogor-drifter-unity" }
teogor-drifter-unity-2022-3-7f1 = { group = "dev.teogor.drifter", name = "drifter-unity-2022-3-7f1", version.ref = "teogor-drifter-unity" }
gradle/libs.versions.toml
[versions]
teogor-drifter-unity = "1.0.0-alpha01"

[libraries]
teogor-drifter-unity-common = { module = "dev.teogor.drifter:drifter-unity-common", version.ref = "teogor-drifter-unity" }
teogor-drifter-unity-2022-3-7f1 = { module = "dev.teogor.drifter:drifter-unity-2022-3-7f1", version.ref = "teogor-drifter-unity" }

Then, add these dependencies in your app's build.gradle file:

build.gradle
dependencies {
    implementation libs.teogor.drifter.unity.common
    implementation libs.teogor.drifter.unity.2022.3.7f1
}
build.gradle.kts
dependencies {
    implementation(libs.teogor.drifter.unity.common)
    implementation(libs.teogor.drifter.unity.2022.3.7f1)
}