Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.3.8f1
Issue ID
1137960
Regression
No
EditorOnly Tag is ignored on Prefabs that are instantiated by code
How to reproduce:
1. Open the user-submitted project ("EditorOnlyBug.zip")
2. Build the project and observe the text objects
Expected result: the "EditorOnly" tagged text objects are not visible in the build
Actual result: The instantiated prefab text objects are not removed in the build even though they have the "EditorOnly" tag
Reproduced in: 2019.2.0a9, 2019.1.0b8, 2018.3.10f1, 2018.2.0f2
-
Alejandro-Martinez-Chacin
Sep 30, 2021 16:58
Oh, just seriously got bit by this one.
Use case:
- Thousands of prefabs instantiated to create a level. These prefabs have particle systems, sounds, etc (self contained objects).
- Particle systems just for existing (even if not awoken and completely disabled) take a small memory footprint. This adds up to sometimes GBs of memory on particles that might never be played.Solution:
- Have a pool of particles to be reused for each of those previous instances when needed.
- For editing purposes, work with the particle systems inside the prefab for placement, sizing, etc... leave this particle system as EditorOnly as it will be instantiated/placed later on dynamically on the parent of that Transform.This fails then because the EditorOnly tag won't cull objects tagged as EditorOnly inside prefabs.
Is there any interest in taking a second look at this at some point? 'EditorOnly' is a bit misleading if it is only 'EditorOnly if the object is standing there on a scene'
Or maybe some best practices to do it as a build post process? when the prefabs get processed for a build?Thanks in advance
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
- The Scene View becomes gray and "NullReferenceException" errors are thrown when attaching the Unity Editor process to RenderDoc
- Memory usage rapidly rises when changing colors in the color wheel
- Physically Based Sky's Horizon and Zenith Tint Color Selection Bars don't have immediate access to color pickers
- EmptyAdditionalLightShadowmapTexture leaks from memory when URP quality level is changed using QualitySettings.SetQualityLevel
- Referenced ScriptableObject field does not get updated and cannot be set to "None" when there are no Objects of that type
Resolution Note:
The EditorOnly tag is only supported on objects in Scenes, and has never been supported on assets being built into an asset bundle. We do not plan on adding support for this at this time.