Search Issue Tracker

Third Party Issue

Votes

0

Found in

2021.3.38f1

2022.3.26f1

6000.0.0f1

Issue ID

UUM-70793

Regression

No

Errors regarding importing occur upon opening a project when the "Library" folder is deleted

-

Reproduction steps:
1. Delete the “Library” folder (if it exists)
2. Open the attached “BugRepro” project
3. Observe the Console window

Expected result: No errors are printed out
Actual result: Errors regarding assets unable to load are printed out

Reproducible with: 2021.3.38f1, 2022.3.26f1, 6000.0.0f1

Reproducible on: Windows 10
Not reproducible on: No other environment tested

Errors:
{code:java}
Protobuf Unity : Could not make proto path relative: C:\Users\[user]\Documents\UnityReviews\IN-74574_repro-project-unity-2022\UnityProjects\TemplateMobileURP\Packages/com.frimastudio.game-database/Runtime/Data/Proto/data_guid.proto: No such file or directory

UnityEngine.Debug:LogError (object)
E7.Protobuf.ProtobufUnityCompiler:CompileProtobufSystemPath (string,string[]) (at C:/Users/[user]/Documents/UnityReviews/IN-74574_repro-project-unity-2022/Packages/protobuf-unity/Editor/ProtobufUnityCompiler.cs:196)
E7.Protobuf.ProtobufUnityCompiler:CompileProtobufAssetPath (string,string[]) (at C:/Users/[user]/Documents/UnityReviews/IN-74574_repro-project-unity-2022/Packages/protobuf-unity/Editor/ProtobufUnityCompiler.cs:133)
E7.Protobuf.ProtobufUnityCompiler:OnPostprocessAllAssets (string[],string[],string[],string[]) (at C:/Users/[user]/Documents/UnityReviews/IN-74574_repro-project-unity-2022/Packages/protobuf-unity/Editor/ProtobufUnityCompiler.cs:84)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets (string[],string[],string[],string[],string[],bool) {code}

  1. Resolution Note:

    The problem is in the user code, more specifically in:
    ```
    private static bool CompileProtobufAssetPath(string assetPath, string[] includePaths)
    {
    string protoFileSystemPath = Directory.GetParent(Application.dataPath) +
    Path.DirectorySeparatorChar.ToString() + assetPath;
    return CompileProtobufSystemPath(protoFileSystemPath, includePaths);
    }
    ```
    Replacing this function with:
    ```
    private static bool CompileProtobufAssetPath(string assetPath, string[] includePaths)
    {
    string protoFileSystemPath = System.IO.Path.GetFullPath(assetPath);
    return CompileProtobufSystemPath(protoFileSystemPath, includePaths);
    }
    ```
    works as expected. Please note that in our documentation we clearly state that one needs to use `Path.GetFullPath` to resolve absolute paths: https://docs.unity3d.com/6000.0/Documentation/Manual/upm-assets.html

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.