-
Notifications
You must be signed in to change notification settings - Fork 50
Comparing changes
Open a pull request
base repository: firebase/firebase-unity-sdk
base: main
head repository: firebase/firebase-unity-sdk
compare: feature/windows-analytics-dll-copy
- 6 commits
- 2 files changed
- 1 contributor
Commits on Jun 16, 2025
-
feat: Copy analytics_win.dll for Windows Build and Play Mode
This change addresses an issue where `analytics_win.dll` was not being included in Windows builds or available during Play Mode when the Firebase Analytics module was present. The following modifications were made: - Modified `editor/app/src/DllLocationPatcher.cs`: - Added logic to `OnPostProcessBuild` to copy `analytics_win.dll` from the project root to the build's plugin directory (`<project_name>_Data/Plugins/`) when building for StandaloneWindows or StandaloneWindows64, but only if the Firebase Analytics module is detected and the DLL exists. - Created `editor/app/src/AnalyticsPlayModeSetup.cs`: - This new editor script subscribes to `EditorApplication.playModeStateChanged`. - When entering Play Mode on a Windows editor, it checks for the Firebase Analytics module and the existence of `analytics_win.dll` in the project root. - If both conditions are met, it copies `analytics_win.dll` to `Assets/Plugins/` to make it available during Play Mode. These changes ensure that `analytics_win.dll` is correctly placed for both Windows builds and Play Mode sessions, facilitating proper Firebase Analytics functionality on the Windows platform.
Configuration menu - View commit details
-
Copy full SHA for a08a6c1 - Browse repository at this point
Copy the full SHA a08a6c1View commit details -
refactor: Use shared constants and add error handling for Analytics D…
…LL copy This commit addresses feedback from the previous review: - Created `FirebaseAnalyticsEditorConstants.cs` to store shared constants for: - `DllName` ("analytics_win.dll") - `DllSourcePath` ("./analytics_win.dll") - `AnalyticsTypeFullName` ("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics") - Updated `editor/app/src/DllLocationPatcher.cs`: - Replaced hardcoded strings with the new shared constants. - Wrapped file I/O operations (directory creation and DLL copy for Windows builds) in a try-catch block to handle potential exceptions (e.g., IOExceptions, UnauthorizedAccessException) and log specific errors. - Updated `editor/app/src/AnalyticsPlayModeSetup.cs`: - Replaced hardcoded strings and local constants with the new shared constants. - Wrapped file I/O operations (directory creation and DLL copy for Play Mode) in a try-catch block to handle potential exceptions and log specific errors. These changes improve maintainability by centralizing critical strings and enhance robustness by ensuring that file operation errors during build post-processing or Play Mode setup are caught and logged gracefully.
Configuration menu - View commit details
-
Copy full SHA for 7f94742 - Browse repository at this point
Copy the full SHA 7f94742View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 949ac29 - Browse repository at this point
Copy the full SHA 949ac29View commit details -
fix: Prevent self-copy of analytics_win.dll in Play Mode
This commit refines the logic in `AnalyticsPlayModeSetup.cs` to correctly handle the scenario where `analytics_win.dll` (the source) is already located in the project root (the destination for Play Mode). Previously, if the DLL was in the project root, the `File.Copy` operation would attempt to copy the file onto itself, resulting in an `IOException`. Changes in `editor/app/src/AnalyticsPlayModeSetup.cs`: - Before attempting to copy the DLL for Play Mode: - The full canonical paths of the source and destination are now compared. - If the source and destination paths are identical (i.e., the DLL is already in the project root), the copy operation is skipped, and an informational message is logged. - The file copy (with its try-catch block) only proceeds if the source and destination paths are different. This prevents an unnecessary `IOException` and ensures the setup is cleaner when the DLL is already correctly placed for Play Mode.
Configuration menu - View commit details
-
Copy full SHA for 8b402ea - Browse repository at this point
Copy the full SHA 8b402eaView commit details -
fix: Add .asmdef for editor scripts to resolve Mac build error
This commit introduces `Firebase.Editor.App.asmdef` in the `editor/app/src/` directory. The purpose of this assembly definition file is to: 1. Define a distinct assembly named `Firebase.Editor.App` for the editor scripts located in `editor/app/src/` (including `DllLocationPatcher.cs`, `AnalyticsPlayModeSetup.cs`, and `FirebaseAnalyticsEditorConstants.cs`). 2. Ensure this assembly is compiled exclusively for the Unity Editor environment by setting `includePlatforms: ["Editor"]`. 3. Improve code organization and compilation consistency across different operating systems. This change directly addresses a build error reported on Mac (`CS0103: The name 'FirebaseAnalyticsEditorConstants' does not exist in the current context`), which occurred because the editor scripts were not being compiled into a clearly defined assembly, leading to symbol resolution issues on that platform. The new .asmdef file ensures that all relevant editor scripts are compiled together, making `FirebaseAnalyticsEditorConstants` accessible to other scripts within the same `Firebase.Editor.App` assembly during editor script compilation on all platforms.
Configuration menu - View commit details
-
Copy full SHA for 7d38c42 - Browse repository at this point
Copy the full SHA 7d38c42View commit details -
Based on your feedback, I've reverted some recent changes to simplify…
… the file structure and address a potential build error you encountered on Mac. Specifically, I have: 1. **Removed `.asmdef` from `editor/app/src/`**: The editor scripts in this directory will now be compiled into the default editor assembly. 2. **Removed `FirebaseAnalyticsEditorConstants.cs` and reverted its usage**: * `editor/app/src/DllLocationPatcher.cs` now uses hardcoded strings for DLL names, paths, and type lookups. * `editor/app/src/AnalyticsPlayModeSetup.cs` now uses hardcoded strings for DLL names, paths, and type lookups. The goal here is to make things simpler and resolve the Mac build error (`CS0103: The name 'FirebaseAnalyticsEditorConstants' does not exist in the current context`) by removing the file that seemed to be causing the issue. If the build error continues on your Mac, I'll investigate further with this simplified setup.
Configuration menu - View commit details
-
Copy full SHA for 13aba5b - Browse repository at this point
Copy the full SHA 13aba5bView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...feature/windows-analytics-dll-copy