Search Issue Tracker
By Design
By Design in 6000.5.X
Votes
0
Found in
6000.0.66f1
6000.3.4f1
6000.4.0b5
6000.5.0a5
Issue ID
UUM-132567
Regression
No
Error "NullReferenceException: Object reference not set to an instance of an object" is present and Asset Bundle is not loaded when using a relative path in a Windows Standalone Player
Reproduction steps:
1. Open the attached project "ReproProj"
2. Open the “/Assets/Scenes/SampleScene.unity” Scene
3. In Menu bar click “Assets > Build AssetBundles”
4. Enter the Play Mode
5. Observe that penguin is present
6. Open Build Profiles (File > Build Profiles)
7. Build And Run
8. Observe the Player
Expected result: Penguin exists and no Errors are present
Actual result: Penguin is not present and Error “NullReferenceException: Object reference not set to an instance of an object“ is present
Reproducible with: 6000.0.66f1, 6000.3.5f1, 6000.4.0b5, 6000.5.0a5
Reproducible on:
Windows Standalone Player
Not reproducible on:
Play Mode
Testing environment: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested
Note:
- If you copy the Bundles folder into the "_Data" folder then the bundle is loaded correctly
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
Thank you for reporting a bug to Unity.
After reviewing the behavior, we've confirmed it aligns with the current design and intended use of the feature. We understand this may differ from your expectations or workflow.
This issue is not caused by a Unity bug. The project’s OnPostprocessBuild script copies AssetBundles to the build root using Directory.GetCurrentDirectory(), which is not guaranteed to return the project directory. In Unity 6 and higher, the Player’s LocalFileSystem root resolves to the <BuildName>_Data folder, so bundles must be placed inside this directory to load correctly. Because the bundles are copied to the wrong location, the Player cannot locate them and a NullReferenceException occurs. Updating the post‑build script to derive the data folder path from report.summary.outputPath resolves the problem. For reference on how Player data paths are structured, see Unity’s documentation for Application.dataPath: https://docs.unity3d.com/ScriptReference/Application-dataPath.html
Resolution Note (6000.5.X):
Thank you for reporting a bug to Unity.
After reviewing the behavior, we've confirmed it aligns with the current design and intended use of the feature. We understand this may differ from your expectations or workflow.
This issue is not caused by a Unity bug. The project’s OnPostprocessBuild script copies AssetBundles to the build root using Directory.GetCurrentDirectory(), which is not guaranteed to return the project directory. In Unity 6 and higher, the Player’s LocalFileSystem root resolves to the <BuildName>_Data folder, so bundles must be placed inside this directory to load correctly. Because the bundles are copied to the wrong location, the Player cannot locate them and a NullReferenceException occurs. Updating the post‑build script to derive the data folder path from report.summary.outputPath resolves the problem. For reference on how Player data paths are structured, see Unity’s documentation for Application.dataPath: https://docs.unity3d.com/ScriptReference/Application-dataPath.html