From 03e7c0aab7d0c400370e79b906622ae45d3bcc08 Mon Sep 17 00:00:00 2001 From: Stefan Richter <o-s-r1993@web.de> Date: Thu, 16 May 2024 19:21:28 +0200 Subject: [PATCH] Added option for using replacement folder. Use StreamToDataPath only for debugging. --- .../InteractionEngine/CommunicationEvents.cs | 4 +++- Assets/Scripts/Loading/StreamingAssetLoader.cs | 5 +++-- Assets/StreamingAssets/README_StreamingAssets.md | 14 +++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index 0f349447..70867258 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -109,8 +109,10 @@ public static string CreateHierarchiePath(List<Directories> hierarchie, string p public static string Get_DataPath() { + bool use_replacementfolder = false; + if (Application.isEditor) - return Path.Combine(Application.dataPath, "StreamingAssets", "StreamToDataPath_withHandler"); + return use_replacementfolder ? Path.Combine(Application.persistentDataPath, "DataPath_writeable") : Path.Combine(Application.dataPath, "StreamingAssets", "StreamToDataPath_withHandler"); return Opsys switch { diff --git a/Assets/Scripts/Loading/StreamingAssetLoader.cs b/Assets/Scripts/Loading/StreamingAssetLoader.cs index ac80d957..0f5d00a1 100644 --- a/Assets/Scripts/Loading/StreamingAssetLoader.cs +++ b/Assets/Scripts/Loading/StreamingAssetLoader.cs @@ -232,9 +232,10 @@ public static void RereadFiles_DataPath() //Debug.Log("Reread_DataPath"); string rootPath = Path.Combine(Application.streamingAssetsPath, StreamToDataPath_Folder); string targetFolder = Application.dataPath; - if (Application.isEditor) + bool useReplacementFolderWhenInEditor = false; + if (Application.isEditor && useReplacementFolderWhenInEditor) { - Get_DataPath(); + targetFolder = Get_DataPath(); } RereadFiles_DataPath_withHandler(); diff --git a/Assets/StreamingAssets/README_StreamingAssets.md b/Assets/StreamingAssets/README_StreamingAssets.md index 3325745a..980068a0 100644 --- a/Assets/StreamingAssets/README_StreamingAssets.md +++ b/Assets/StreamingAssets/README_StreamingAssets.md @@ -1,18 +1,11 @@ ## Info: For OperatingSystem Android: please register all Files in StreamingAssetLoader! - -## StreamToDataPath: -All files and subfolders will be copied to DataPath. -Will be triggered on each start of the game. -Exception: Files with "meta" in the name. - ## StreamToPersistentDataPath: All files and subfolders will be copied to PersistentDataPath. Will be triggered on first time installing the game or with the corresponding restart buttons. Exception: Files with "meta" in the name. - ## StreamToDataPath_withHandler: If Operatingsystem is Android, then: - All files and subfolders will be copied to PersistentDataPath. @@ -20,3 +13,10 @@ If Operatingsystem is Android, then: If Operatingsystem is other than Android, then: - All files and subfolders will be copied to DataPath. - Exception: Files with "meta" in the name. + +## StreamToDataPath: +All files and subfolders will be copied to DataPath. +Will be triggered on each start of the game. +Exception: Files with "meta" in the name. +-> Use StreamToDataPath only for debugging. +-> Otherwise use StreamToDataPath_withHandler \ No newline at end of file -- GitLab