Skip to content

Commit eec18f3

Browse files
authored
Fix ios export for Unity 6.
1 parent b0ad5ff commit eec18f3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

example/unity/DemoApp/Assets/FlutterUnityIntegration/Editor/XCodePostBuild.cs

+10-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public static class XcodePostBuild
4141
/// </summary>
4242
private const string TouchedMarker = "https://github.com/juicycleff/flutter-unity-view-widget";
4343

44+
// String used to detect where to inject function definitions in UnityAppController.h
45+
#if UNITY_6000_0_OR_NEWER
46+
private const string hDetection = "#import <UnityFramework/RenderPluginDelegate.h>";
47+
#else
48+
private const string hDetection = "include \"RenderPluginDelegate.h\"";
49+
#endif
50+
4451
//trigger this manually from build.cs as [PostProcessBuild] or IPostprocessBuildWithReport don't always seem to trigger.
4552
public static void PostBuild(BuildTarget target, string pathToBuiltProject)
4653
{
@@ -124,7 +131,7 @@ private static bool MarkUnityAppControllerH(string path)
124131
var mark = false;
125132
EditCodeFile(path, line =>
126133
{
127-
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
134+
inScope |= line.Contains(hDetection);
128135
if (inScope)
129136
{
130137
if (line.Trim() == "")
@@ -197,7 +204,7 @@ private static void EditUnityAppControllerH(string path)
197204
// Modify inline GetAppController
198205
EditCodeFile(path, line =>
199206
{
200-
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
207+
inScope |= line.Contains(hDetection);
201208

202209
if (inScope && !markerDetected)
203210
{
@@ -230,7 +237,7 @@ private static void EditUnityAppControllerH(string path)
230237
// Modify inline GetAppController
231238
EditCodeFile(path, line =>
232239
{
233-
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
240+
inScope |= line.Contains(hDetection);
234241

235242
if (inScope && !markerDetected)
236243
{

0 commit comments

Comments
 (0)