@ -39,7 +39,65 @@ How to test gRPC in a Unity project
4. Unity IDE will pick up all the bundled files and add them to project automatically.
You should be able to use gRPC and Protobuf in your scripts from now on.
5. (optional) Extra steps for iOS, see below
What's currently bundled in the `grpc_unity_package`
- Grpc.Core and its dependencies
- Google.Protobuf
- Precompiled native libraries for Linux, MacOS, Windows, Android and iOS.
Please note that `Grpc.Core` is now in maintenance mode (see [The future of gRPC in C# belongs to grpc-dotnet](https://grpc.io/blog/grpc-csharp-future/)). There is a plan to support Unity in `Grpc.Net.Client`, which depends on Unity's .NET 5 or .NET 6 support. See [this issue](https://github.com/grpc/grpc-dotnet/issues/1309) for more information.
## Building for iOS
To build a Unity app on iOS, there are extra steps to do to make it work:
1. Add a `Assets/link.xml` asset file to your Unity project with the following content:
If you don't, you might encounter the following error: `System.IO.FileNotFoundException: Error loading native library. Not found in any of the possible locations:` with a list of paths that point to the `libgrpc_csharp_ext.x64.dylib` file.
2. Due to the growing build size, bitcode has been disabled for the gRPC library. You must disable it in your XCode project as well.
3. Add the `libz` framework.
Steps 2 and 3 can be automated by adding the following `Assets/Scripts/BuildIos.cs` script in your Unity project, and attaching it to a Unity game object:
```cs
#if UNITY_EDITOR && UNITY_IOS
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
public class BuildIos
{
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget target, string path)
{
var projectPath = PBXProject.GetPBXProjectPath(path);