Skip to content

Android Build Error: DirectoryNotFoundException when loading tags from StreamingAssets #21

Description

@machamy

Description
I encountered a runtime error when building for Android.
The issue is caused by BuildGameplayTagSource.cs trying to access Application.streamingAssetsPath using System.IO.File.OpenRead.

On Android, StreamingAssets are contained within the APK (compressed), so standard System.IO methods cannot access them directly. This results in a "Could not find a part of the path" error.

Error Log

Error Unity Failed to load gameplay tags from StreamingAssets: Could not find a part of the path "/file:/data/data/com.KimBopHeaven_UniJam.KimBopHeaven_UniJam/pram-shadow-files/assets/GameplayTags".
Error Unity BandoWare.GameplayTags.BuildGameplayTagSource:RegisterTags(GameplayTagRegistrationContext)
Error Unity BandoWare.GameplayTags.GameplayTagManager:InitializeIfNeeded()

Problematic Code (BuildGameplayTagSource.cs)
The current implementation uses File.OpenRead which is not compatible with Android's StreamingAssets path format (jar:file://...).

// Current Code
using FileStream file = File.OpenRead(Path.Combine(Application.streamingAssetsPath, "GameplayTags"));

Environment

  • Unity Version: 6000.3.4
  • Platform: Android

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions