Skip to content

Commit a05b3c5

Browse files
committed
load lib in Boostrap
1 parent a9394ec commit a05b3c5

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

Assets/AndroidIl2cppPatchDemo/Editor/AndroidBuilder.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,7 @@ public static bool PatchAndroidProject()
189189
import io.github.noodle1983.Boostrap;");
190190

191191
allJavaText = allJavaText.Replace("mUnityPlayer = new UnityPlayer(this);",
192-
@"System.loadLibrary(""main"");
193-
System.loadLibrary(""unity"");
194-
System.loadLibrary(""bootstrap"");
195-
Boostrap.init(getApplication().getApplicationContext().getFilesDir().getPath());
192+
@"Boostrap.InitNativeLibBeforeUnityPlay(getApplication().getApplicationContext().getFilesDir().getPath());
196193
mUnityPlayer = new UnityPlayer(this);");
197194
File.WriteAllText(javaEntranceFile, allJavaText);
198195
return true;

Assets/AndroidIl2cppPatchDemo/Plugins/Android/java/io/github/noodle1983/Boostrap.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@
33
public class Boostrap
44
{
55
public static native void init(String filePath);
6+
7+
public static void InitNativeLibBeforeUnityPlay(String filePath)
8+
{
9+
System.loadLibrary("main");
10+
System.loadLibrary("unity");
11+
System.loadLibrary("bootstrap");
12+
init(filePath);
13+
}
614
}

0 commit comments

Comments
 (0)