Skip to content

Commit 949ac29

Browse files
fix: Correct Play Mode DLL copy path for analytics_win.dll
This commit corrects the destination path for `analytics_win.dll` when copied during Play Mode setup on Windows. Previously, the DLL was copied to `Assets/Plugins/`. This has been changed to the project root (`./`). Copying to the project root ensures that the native DLL can be found by the Unity editor executable when using P/Invoke, which typically searches the application's directory. Changes in `editor/app/src/AnalyticsPlayModeSetup.cs`: - The destination directory for copying `analytics_win.dll` in Play Mode is now `"./"` (the project root). - The corresponding log message has been updated. - Removed the `AssetDatabase.Refresh()` call, as it's not necessary for this type of DLL handling in the editor. The build-time copy location in `DllLocationPatcher.cs` remains unchanged as it was already correct for standalone builds.
1 parent 7f94742 commit 949ac29

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

editor/app/src/AnalyticsPlayModeSetup.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Firebase.Editor {
77

88
[InitializeOnLoad]
99
internal static class AnalyticsPlayModeSetup {
10-
private const string DestinationDir = "Assets/Plugins/";
10+
private const string DestinationDir = "./";
1111

1212
static AnalyticsPlayModeSetup() {
1313
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
@@ -20,11 +20,10 @@ private static void OnPlayModeStateChanged(PlayModeStateChange state) {
2020
if (firebaseAnalyticsType != null) {
2121
if (File.Exists(FirebaseAnalyticsEditorConstants.DllSourcePath)) {
2222
try {
23-
Directory.CreateDirectory(DestinationDir);
23+
Directory.CreateDirectory(DestinationDir); // Should be benign for "./"
2424
string destinationDllPath = Path.Combine(DestinationDir, FirebaseAnalyticsEditorConstants.DllName);
2525
File.Copy(FirebaseAnalyticsEditorConstants.DllSourcePath, destinationDllPath, true);
26-
Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to " + DestinationDir + " for Play Mode.");
27-
AssetDatabase.Refresh();
26+
Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to project root for Play Mode.");
2827
} catch (Exception e) {
2928
Debug.LogError("Firebase Analytics: Error copying " + FirebaseAnalyticsEditorConstants.DllName + " for Play Mode: " + e.Message);
3029
}

0 commit comments

Comments
 (0)