Skip to content

Commit 6724bf2

Browse files
committed
Added information about stripping folders from prefabs to README
1 parent e6132b8 commit 6724bf2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Editor/Prefab Handling/PrefabFolderStripper.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,17 @@ private static void HandlePrefabsOnPlayMode(PlayModeStateChange state)
3636
if ( ! StripSettings.StripFoldersFromPrefabsInPlayMode || StripSettings.PlayMode == StrippingMode.DoNothing)
3737
return;
3838

39+
3940
if (state == PlayModeStateChange.ExitingEditMode)
41+
{
42+
// Stripping folders from all prefabs in the project instead of only the ones referenced in the scenes
43+
// because a prefab can be hot-swapped in Play Mode.
4044
StripFoldersFromAllPrefabs();
45+
}
4146
else if (state == PlayModeStateChange.EnteredEditMode)
47+
{
4248
RevertChanges();
49+
}
4350
}
4451

4552
private static void StripFoldersFromDependentPrefabs()

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ To install OpenUPM, please see the [documentation][2].
5555

5656
## Stripping Modes
5757

58-
You can choose how exactly the folder will be removed from the hierarchy in **Preferences -> HierarchyFolders**.
58+
You can choose how exactly the folder will be removed from the hierarchy in **Preferences -> Hierarchy Folders**.
5959

6060
The following stripping modes are available:
6161

@@ -64,6 +64,10 @@ The following stripping modes are available:
6464
- **Do Nothing** *(available only for Play Mode)* - The folder will not be removed, the hierarchy will not change in play mode. Use this mode if you don't need extra performance in Editor.
6565
- **Replace With Separator** *(available only for Play Mode)* - The hierarchy will flatten, and the folder will be replaced with a separator (e.g. "--- FOLDER ---"). Useful if you need extra performance in Editor but still want to see what folder game objects belong to.
6666

67+
## Stripping folders from prefabs
68+
69+
With this plugin, it is possible to strip folders from prefabs that are not present in the scene but are instantiated at runtime. Upon entering Play Mode, the plugin goes through all prefabs containing folders and strips them. On exiting Play Mode, the changes are reverted. It shouldn't add significant overhead unless you have thousands of prefabs with folders inside, but if entering Play Mode takes too long, you can try disabling this option in **Preferences -> Hierarchy Folders**. You can also choose whether to strip folders from prefabs before they are packed into a build.
70+
6771
## Possible FAQs
6872

6973
### Why folders in the first place?

0 commit comments

Comments
 (0)