Skip to content

Commit

Permalink
Merge pull request #26 from teogor/docs/usage-guide-and-compatibility
Browse files Browse the repository at this point in the history
Update Documentation: Plugin Usage Guide and Unity Compatibility
  • Loading branch information
teogor authored Aug 20, 2024
2 parents 7a0a369 + 3a24409 commit d91dfbd
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 124 deletions.
124 changes: 0 additions & 124 deletions docs/drifter-plugin.md

This file was deleted.

164 changes: 164 additions & 0 deletions docs/plugin-usage-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Usage Guide for Plugin (Unity Integration Plugin)

## Overview

The Unity Integration Plugin simplifies the process of integrating Unity projects into your Gradle-based project. It provides two essential tasks: `BuildIl2CppTask` and `UnityAssetSyncTask`. This guide explains how to use these tasks effectively.

## Prerequisites

Before using the Unity Integration Plugin, ensure the following:

- You have a Gradle-based Android project.
- Unity projects to be integrated have been properly exported.

## Installation

To get started, add the Unity Integration Plugin to your `build.gradle` file:

=== "Groovy"

```groovy title="build.gradle"
apply plugin: 'dev.teogor.drifter.plugin'
```

=== "Kotlin"

```kotlin title="build.gradle.kts"
plugins {
id("dev.teogor.drifter.plugin")
}
```

## Using `BuildIl2CppTask`

### Purpose

The `BuildIl2CppTask` automates the compilation and building of Il2Cpp for Unity integration. It enhances the efficiency of your development workflow by handling complex build processes.

### Configuration

To use `BuildIl2CppTask`, follow these steps:

1. Configure Unity options in your `build.gradle` file:

=== "Groovy"

```groovy title="build.gradle"
unityOptions {
exportFolder = 'path/to/unity/export/folder'
libraryName = 'YourUnityLibrary'
// Add more configuration options as needed
}
```

=== "Kotlin"

```kotlin title="build.gradle.kts"
val unityOptions = mapOf(
"exportFolder" to "path/to/unity/export/folder",
"libraryName" to "YourUnityLibrary"
// Add more configuration options as needed
)
```

2. Create the task and set Unity options:

=== "Groovy"

```groovy title="build.gradle"
createBuildIl2CppTask(unityOptions)
```

=== "Kotlin"

```kotlin title="build.gradle.kts"
createBuildIl2CppTask(unityOptions)
```

3. Execute the task:

```shell
./gradlew buildIl2Cpp
```

Here's a Kotlin code snippet for your `build.gradle` file that demonstrates the configuration and usage:

=== "Kotlin"

```kotlin title="build.gradle.kts"
// Configure Unity options
val unityOptions = mapOf(
"exportFolder" to "path/to/unity/export/folder",
"libraryName" to "YourUnityLibrary"
// Add more configuration options as needed
)

// Create and set up the BuildIl2CppTask
createBuildIl2CppTask(unityOptions)

// Execute the BuildIl2CppTask
tasks.named("buildIl2Cpp").configure {
// Add any additional configuration or dependencies here if needed
// For example:
// dependsOn("someOtherTask")
}
```

### Using `UnityAssetSyncTask`

### Purpose

The `UnityAssetSyncTask` streamlines the synchronization of Unity exported assets with your project. It prepares the project for Unity integration by copying essential folders.

### Configuration

To use `UnityAssetSyncTask`, follow these steps:

1. Configure Unity options in your `build.gradle` file (if not already done).

2. Create the task and set Unity options:

=== "Groovy"

```groovy title="build.gradle"
createUnityAssetSyncTask(unityOptions)
```

=== "Kotlin"

```kotlin title="build.gradle.kts"
createUnityAssetSyncTask(unityOptions)
```

3. Execute the task:

```shell
./gradlew syncUnityAssets
```

Here's a Kotlin code snippet for your `build.gradle` file that demonstrates the configuration and usage:

=== "Kotlin"

```kotlin title="build.gradle.kts"
// Create and set up the UnityAssetSyncTask
createUnityAssetSyncTask(unityOptions)

// Execute the UnityAssetSyncTask
tasks.named("syncUnityAssets").configure {
// Add any additional configuration or dependencies here if needed
// For example:
// dependsOn("anotherTask")
}
```

## Conclusion

With the Unity Integration Plugin, you can seamlessly integrate Unity projects into your Gradle-based project, enhancing the development process and ensuring consistency. If you encounter any issues or have feature requests, please don't hesitate to contribute or reach out for support.

## Quick References

1. [Installation](#installation)
2. [Using `BuildIl2CppTask`](#using-buildil2cpptask)
3. [Using `UnityAssetSyncTask`](#using-unityassetsynctask)
4. [Conclusion](#conclusion)
73 changes: 73 additions & 0 deletions docs/unity-compatibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Unity Module Compatibility

Drifter is a comprehensive library designed to enhance and streamline your Unity development
workflow. This document outlines the specific Unity versions that the Drifter library supports.

## Supported Unity Versions

| Version | Release Date | Release Notes | Hub Installation | Downloads |
|-----------------|--------------|---------------------------------------------------------------------|------------------------------------|---------------------------------------------------------------------------|
| **2022.3.42f1** | 13 Aug 2024 | [Read](https://unity.com/releases/editor/whats-new/2022.3.42#notes) | [Install](unityhub://2022.3.42f1/) | [See all](https://unity.com/releases/editor/whats-new/2022.3.42#installs) |
| **2022.3.7f1** | 8 Aug 2023 | [Read](https://unity.com/releases/editor/whats-new/2022.3.7#notes) | [Install](unityhub://2022.3.7f1/) | [See all](https://unity.com/releases/editor/whats-new/2022.3.7#installs) |

## How to Use

To ensure compatibility and take full advantage of the features provided by Drifter, make sure you
are using one of the supported Unity versions listed above.

### Installation Steps

1. Import the Drifter library into your project.
2. Import the relevant Unity module from Drifter that suits your project requirements.
Here’s the refined section with the installation steps incorporating the code snippets:

### Installation Steps

1. Import the Drifter library into your project.

For more details, view the [implementation guide](releases/implementation.md).

2. Import the relevant Unity module from Drifter that suits your project requirements.

For example, to implement the Drifter Unity module for `v2022.3.7f1`, add the following
dependency:

```kotlin
dependencies {
implementation("dev.teogor.drifter:drifter-unity-2022-3-7f1:$version")
}
```

3. Set up your `Application` class to initialize Drifter with the appropriate Unity version.

Update your `Application` class as follows:

```kotlin
class DemoApplication : Application() {

override fun onCreate() {
super.onCreate()

// Initialize Drifter with the Unity factory for version 2022.3.7f1
RegistryStartup.provides(withUnity202237f1Factory())
}
}
```

Alternatively, you can use `LocalUnityEngine` to provide the Unity factory:

```kotlin
LocalUnityEngine provide Unity202237f1Factory()
```

## Need Help?

If you encounter any issues or have questions regarding compatibility, feel free to open an issue on
the [GitHub Issues page](https://github.com/teogor/drifter/issues).

## Quick References

1. [Supported Unity Versions](#supported-unity-versions)
2. [How to Use](#how-to-use)
3. [Installation Steps](#installation-steps)
4. [Need Help?](#need-help)
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ nav:
- Home:
- Overview: index.md
- Unity Engine Composable: unity-engine-jetpack-compose.md
- Unity Compatibility: unity-compatibility.md
- Plugin Usage Guide: plugin-usage-guide.md
- Releases:
- releases.md
- Implementation: releases/implementation.md
Expand Down

0 comments on commit d91dfbd

Please sign in to comment.