Search Issue Tracker
By Design
By Design in 2023.3.X
Votes
0
Found in
2022.3.7f1
2023.1.8f1
2023.2.0b4
2023.3.0a2
Issue ID
UUM-46879
Regression
Yes
Exceptions are thrown in the Profiler (Standalone Process) window Console when IsValidFolder and CreateAssets are called
How to reproduce:
1. Open the attached “StandaloneProfilerBugs.zip“ project
2. Open the Profiler (Window> Analysis> Profiler (Standalone Process))
Expected result: No errors in the Profiler Console
Actual result: “System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.“ and “CreateSerializedAsset is not supported while importing in a slave“ errors in the Profiler Console
Reproducible with: 2022.2.0a3, 2022.3.7f1, 2023.1.8f1, 2023.2.0b4, 2023.3.0a2
Not reproducible with: 2021.3.29f1, 2022.2.0a2
Reproducible on: macOS 13.4.1 (Intel), Windows 11 (User Reported)
Not reproducible on: No other environment tested
Notes:
- User reported that IsValidFolder returns true despite being in ProcessLevel.Secondary
- User reported that the exception shouldn't happen because the IsValidFolder call is happening right before CreateAssets. When not called from InitializeOnLoadMethod, no exceptions are thrown
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Localization Group Rules bypasses Locale logic when SharedGroup asset provided
- UI Toolkit World UI Text Field unfocuses immediately when clicking on it using XR Controller
- Crash on CallWindowProcW when entering Play mode for the second time and running the Editor in the background while using System.Windows.Forms functions
- 2D Freeform Light shadows disappear when light center is offset from shape bounds
- Crash on MarkAllDependencies when opening scenes with Assets from the YarnSpinner package
Resolution Note:
Calling `IsValidFolder()` will return true even on the Standalone Profiler process.
The Profiler process is actually a stripped Unity Editor process, so to prevent calling CreateAsset off the main process and prevent the exception being thrown we need to try and detect if the current process is the main Editor, for example, by using (as suggested in the Editor script in the supplied issue) :
if (UnityEditor.MPE.ProcessService.level != UnityEditor.MPE.ProcessLevel.Secondary)
{
AssetDatabase.CreateAsset(settings, path);
AssetDatabase.SaveAssets();
}
Resolution Note (2023.3.X):
Calling `IsValidFolder()` will return true even on the Standalone Profiler process.
The Profiler process is actually a stripped Unity Editor process, so to prevent calling CreateAsset off the main process and prevent the exception being thrown we need to try and detect if the current process is the main Editor, for example, by using (as suggested in the Editor script in the supplied issue) :
if (UnityEditor.MPE.ProcessService.level != UnityEditor.MPE.ProcessLevel.Secondary)
{
AssetDatabase.CreateAsset(settings, path);
AssetDatabase.SaveAssets();
}