Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.unitypackage binary
99 changes: 99 additions & 0 deletions example/unity/DemoApp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
.utmp/
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
*.log

# By default unity supports Blender asset imports, *.blend1 blender files do not need to be commited to version control.
*.blend1
*.blend1.meta

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Recordings can get excessive in size
/[Rr]ecordings/

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Jetbrains Rider personal-layer settings
*.DotSettings.user

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Mono auto generated files
mono_crash.*

# Builds
*.apk
*.aab
*.unitypackage
*.unitypackage.meta
*.app

# Crashlytics generated file
crashlytics-build.properties

# TestRunner generated files
InitTestScene*.unity*

# Addressables default ignores, before user customizations
/ServerData
/[Aa]ssets/StreamingAssets/aa*
/[Aa]ssets/AddressableAssetsData/link.xml*
/[Aa]ssets/Addressables_Temp*
# By default, Addressables content builds will generate addressables_content_state.bin
# files in platform-specific subfolders, for example:
# /Assets/AddressableAssetsData/OSX/addressables_content_state.bin
/[Aa]ssets/AddressableAssetsData/*/*.bin*

# Visual Scripting auto-generated files
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers.meta

# Auto-generated scenes by play mode tests
/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity*
848 changes: 0 additions & 848 deletions example/unity/DemoApp/Assembly-CSharp-Editor.csproj

This file was deleted.

804 changes: 0 additions & 804 deletions example/unity/DemoApp/Assembly-CSharp.csproj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,25 @@ private static void DoBuildAndroid(String buildPath, bool isPlugin, bool isRelea
// remove this line if you don't use a debugger and you want to speed up the flutter build
playerOptions.options = BuildOptions.AllowDebugging | BuildOptions.Development;
}
#if UNITY_2022_1_OR_NEWER
#if UNITY_6000_0_OR_NEWER
PlayerSettings.SetIl2CppCompilerConfiguration(NamedBuildTarget.Android, isReleaseBuild ? Il2CppCompilerConfiguration.Release : Il2CppCompilerConfiguration.Debug);
PlayerSettings.SetIl2CppCodeGeneration(NamedBuildTarget.Android, isReleaseBuild ? Il2CppCodeGeneration.OptimizeSpeed : Il2CppCodeGeneration.OptimizeSize);
#elif UNITY_2022_1_OR_NEWER
PlayerSettings.SetIl2CppCompilerConfiguration(BuildTargetGroup.Android, isReleaseBuild ? Il2CppCompilerConfiguration.Release : Il2CppCompilerConfiguration.Debug);
PlayerSettings.SetIl2CppCodeGeneration(NamedBuildTarget.Android, isReleaseBuild ? Il2CppCodeGeneration.OptimizeSpeed : Il2CppCodeGeneration.OptimizeSize);
#elif UNITY_2021_2_OR_NEWER
PlayerSettings.SetIl2CppCompilerConfiguration(BuildTargetGroup.Android, isReleaseBuild ? Il2CppCompilerConfiguration.Release : Il2CppCompilerConfiguration.Debug);
EditorUserBuildSettings.il2CppCodeGeneration = isReleaseBuild ? Il2CppCodeGeneration.OptimizeSpeed : Il2CppCodeGeneration.OptimizeSize;
#endif


#if UNITY_ANDROID && UNITY_6000_0_OR_NEWER
UnityEditor.Android.UserBuildSettings.DebugSymbols.level = isReleaseBuild ? Unity.Android.Types.DebugSymbolLevel.None : Unity.Android.Types.DebugSymbolLevel.SymbolTable;
UnityEditor.Android.UserBuildSettings.DebugSymbols.format = Unity.Android.Types.DebugSymbolFormat.LegacyExtensions;
#endif
#if UNITY_ANDROID && UNITY_2023_1_OR_NEWER
PlayerSettings.Android.applicationEntry = AndroidApplicationEntry.Activity;
#endif
// Switch to Android standalone build.
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android);
// build addressable
Expand All @@ -229,6 +240,13 @@ private static void DoBuildAndroid(String buildPath, bool isPlugin, bool isRelea

Copy(buildPath, AndroidExportPath);

// Unity 6000 shared folder
string sharedPath = Path.Combine(APKPath, "shared");
if (Directory.Exists(sharedPath))
{
Copy(sharedPath, Path.Combine(AndroidExportPath, "shared"));
}

// Modify build.gradle
ModifyAndroidGradle(isPlugin);

Expand Down Expand Up @@ -338,6 +356,10 @@ private static void ModifyAndroidGradle(bool isPlugin)
// disable the Unity ndk path as it will conflict with Flutter.
buildText = buildText.Replace("ndkPath \"", "// ndkPath \"");

// Untiy 6000, handle ../shared/
buildText = Regex.Replace(buildText, @"\.\./shared/", "./shared/");


// check for namespace definition (Android gradle plugin 8+), add a backwards compatible version if it is missing.
if(!buildText.Contains("namespace"))
{
Expand Down Expand Up @@ -430,7 +452,10 @@ private static void BuildIOS(String path, bool isReleaseBuild)
EditorUserBuildSettings.iOSBuildConfigType = iOSBuildType.Release;
#endif

#if UNITY_2022_1_OR_NEWER
#if UNITY_6000_0_OR_NEWER
PlayerSettings.SetIl2CppCompilerConfiguration(NamedBuildTarget.iOS, isReleaseBuild ? Il2CppCompilerConfiguration.Release : Il2CppCompilerConfiguration.Debug);
PlayerSettings.SetIl2CppCodeGeneration(NamedBuildTarget.iOS, isReleaseBuild ? Il2CppCodeGeneration.OptimizeSpeed : Il2CppCodeGeneration.OptimizeSize);
#elif UNITY_2022_1_OR_NEWER
PlayerSettings.SetIl2CppCompilerConfiguration(BuildTargetGroup.iOS, isReleaseBuild ? Il2CppCompilerConfiguration.Release : Il2CppCompilerConfiguration.Debug);
PlayerSettings.SetIl2CppCodeGeneration(NamedBuildTarget.iOS, isReleaseBuild ? Il2CppCodeGeneration.OptimizeSpeed : Il2CppCodeGeneration.OptimizeSize);
#elif UNITY_2021_2_OR_NEWER
Expand Down Expand Up @@ -628,8 +653,8 @@ private static void SetupAndroidProjectKotlin()
File.WriteAllText(projBuildPath, projBuildScript);
}

// Sets up the project settings.gradle files correctly
if (!Regex.IsMatch(settingsScript, @"include("":unityLibrary"")"))
// Sets up the project settings.gradle.kts files correctly
if (!Regex.IsMatch(settingsScript, @"include\("":unityLibrary""\)"))
{
settingsScript += @"

Expand All @@ -640,7 +665,7 @@ private static void SetupAndroidProjectKotlin()
}


// Sets up the project app build.gradle files correctly
// Sets up the project app build.gradle.kts files correctly
if (!Regex.IsMatch(appBuildScript, @"dependencies \{"))
{
appBuildScript += @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public static class XcodePostBuild
/// </summary>
private const string TouchedMarker = "https://github.com/juicycleff/flutter-unity-view-widget";

// String used to detect where to inject function definitions in UnityAppController.h
#if UNITY_6000_0_OR_NEWER
private const string hDetection = "#import <UnityFramework/RenderPluginDelegate.h>";
#else
private const string hDetection = "include \"RenderPluginDelegate.h\"";
#endif

//trigger this manually from build.cs as [PostProcessBuild] or IPostprocessBuildWithReport don't always seem to trigger.
public static void PostBuild(BuildTarget target, string pathToBuiltProject)
{
Expand Down Expand Up @@ -124,7 +131,7 @@ private static bool MarkUnityAppControllerH(string path)
var mark = false;
EditCodeFile(path, line =>
{
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
inScope |= line.Contains(hDetection);
if (inScope)
{
if (line.Trim() == "")
Expand Down Expand Up @@ -197,7 +204,7 @@ private static void EditUnityAppControllerH(string path)
// Modify inline GetAppController
EditCodeFile(path, line =>
{
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
inScope |= line.Contains(hDetection);

if (inScope && !markerDetected)
{
Expand Down Expand Up @@ -230,7 +237,7 @@ private static void EditUnityAppControllerH(string path)
// Modify inline GetAppController
EditCodeFile(path, line =>
{
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
inScope |= line.Contains(hDetection);

if (inScope && !markerDetected)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Visit https://github.com/juicycleff/flutter-unity-view-widget

unitypackage version: fuw-2022.3.0
unitypackage version: fuw-6000.0.2
26 changes: 0 additions & 26 deletions example/unity/DemoApp/Demo App.sln

This file was deleted.

26 changes: 0 additions & 26 deletions example/unity/DemoApp/DemoApp.sln

This file was deleted.

12 changes: 6 additions & 6 deletions example/unity/DemoApp/Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dependencies": {
"com.unity.collab-proxy": "2.0.3",
"com.unity.collab-proxy": "2.7.1",
"com.unity.ext.nunit": "1.0.6",
"com.unity.ide.rider": "3.0.15",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.rider": "3.0.36",
"com.unity.ide.visualstudio": "2.0.23",
"com.unity.ide.vscode": "1.2.5",
"com.unity.test-framework": "1.1.31",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.1",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.9",
"com.unity.timeline": "1.7.7",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Expand Down
25 changes: 7 additions & 18 deletions example/unity/DemoApp/Packages/packages-lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"com.unity.collab-proxy": {
"version": "2.0.3",
"version": "2.7.1",
"depth": 0,
"source": "registry",
"dependencies": {},
Expand All @@ -15,7 +15,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.rider": {
"version": "3.0.15",
"version": "3.0.36",
"depth": 0,
"source": "registry",
"dependencies": {
Expand All @@ -24,7 +24,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.16",
"version": "2.0.23",
"depth": 0,
"source": "registry",
"dependencies": {
Expand All @@ -40,7 +40,7 @@
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.31",
"version": "1.1.33",
"depth": 0,
"source": "registry",
"dependencies": {
Expand All @@ -51,7 +51,7 @@
"url": "https://packages.unity.com"
},
"com.unity.textmeshpro": {
"version": "3.0.6",
"version": "3.0.9",
"depth": 0,
"source": "registry",
"dependencies": {
Expand All @@ -60,13 +60,13 @@
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.7.1",
"version": "1.7.7",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0"
},
"url": "https://packages.unity.com"
Expand Down Expand Up @@ -212,17 +212,6 @@
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.uielementsnative": "1.0.0"
}
},
"com.unity.modules.uielementsnative": {
"version": "1.0.0",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
Expand Down
Loading