Hi Unity Devs 👋, Struggling with large build sizes? Google Play won’t accept your build? Managed Stripping Level in Unity removes unused code, making builds smaller and more efficient. Stripping Levels: Minimal – Safest, removes the least. Low – Strips more but keeps essential code. Medium – Aggressive but keeps common reflection use. High – Maximum stripping, may break reflection-heavy code. Should You Use It? ✅ For smaller builds, Medium/High works well. ⚠️ If you rely on reflection (JSON, Zenject, etc.), use link.xml to prevent missing code. I've seen significant size reduction using this. If you face issues: 🔹 Lower the stripping level. 🔹 Use link.xml to preserve critical code. 🔹 Enable Code Stripping Logging for debugging. This small setting can make a big impact. Have you used it before? Let’s discuss! #Unity #GameDevelopment #UnityTips #PerformanceOptimization #IndieGameDev
Eliminating Unused Code
Explore top LinkedIn content from expert professionals.
Summary
Eliminating unused code means removing parts of a software program that are no longer needed, helping make the codebase cleaner and more manageable. By regularly cleaning out dead or unnecessary code, teams can improve performance and create simpler, safer programs.
- Review and remove: Regularly scan your project for code that isn't being used and delete it to simplify your codebase and avoid confusion.
- Monitor usage: Use feature flags and tracking tools to identify which features or code sections aren't being used by customers before safely removing them.
- Preserve with backups: Rely on source control systems to keep deleted code accessible in case you ever need to bring something back, so don't hesitate to tidy up.
-
-
Why does Elon Musk celebrate deleting code more than writing it? Although a lot of what he says is controversial, cleaning up unused code isn't and here's why: 1. Easier to maintain - Code that doesn't exist can't have bugs. Not to mention that it doesn't need to be documented 2. Resource optimization - Binary sizes, build processes, and test run times can all be reduced by deploying less code. It's easy for the codebase to grow little by little until this bloat is noticable to users and engineers 3. Increased dev velocity - It's easier to understand existing code and change it since less code is easier to reason about. Engineers waste time understanding code paths that don't matter But what if the code might be used some day? That is the beauty of source control. You can easily look it up again if you need to bring some of it back, so don't worry about cleaning up unused code. What are some other good reasons to delete code?
-
Use anti-feature flags to reach perfection Usually, we use feature flags to ship new code and iteratively release it to customers. However, much of the code we deploy is useless. Either customers don't care about it, or it's dead code from refactoring. Dead code adds complexity and slows down development — useless features confound customers. Use an "anti-feature" to see what you can remove: 🔸 Put a feature flag around a feature you suspect is not being used. 🔸 Enable it by default. Stand back and watch. 🔹 Now you have metrics to see how much it's used. 🔹 You can iteratively remove pointers to it. 🔹 Use A/B tests to see how customers are affected when it is off. 🔹 Once you see it has no traffic, turn it off completely. 🔹 Leave it there for a month and see if customers complain. 🔸 Then delete the code. "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." ― Antoine de Saint-Exupéry ____ 👍 Like or repost for appreciation 🙌 Follow if this resonates 📭 Get the details by subscribing to Dev Details Substack #softwaredevelopment #softwaredesign #productdesign