From 9837fff97fb0a5a28da2c6be44ada6b307d20f8e Mon Sep 17 00:00:00 2001 From: Soraphis Date: Wed, 23 Feb 2022 16:59:42 +0100 Subject: [PATCH] fixing unnecessary allocations when debug mode disabled --- Packages/Core/Runtime/StackTrace/StackTraceEntry.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/Core/Runtime/StackTrace/StackTraceEntry.cs b/Packages/Core/Runtime/StackTrace/StackTraceEntry.cs index 951c45cd..c358e661 100644 --- a/Packages/Core/Runtime/StackTrace/StackTraceEntry.cs +++ b/Packages/Core/Runtime/StackTrace/StackTraceEntry.cs @@ -60,9 +60,9 @@ namespace UnityAtoms } } - public static StackTraceEntry Create(object obj, int skipFrames = 0) => new StackTraceEntry(new StackTrace(skipFrames), obj); + public static StackTraceEntry Create(object obj, int skipFrames = 0) => AtomPreferences.IsDebugModeEnabled ? new StackTraceEntry(new StackTrace(skipFrames), obj) : null; - public static StackTraceEntry Create(int skipFrames = 0) => new StackTraceEntry(new StackTrace(skipFrames)); + public static StackTraceEntry Create(int skipFrames = 0) => AtomPreferences.IsDebugModeEnabled ? new StackTraceEntry(new StackTrace(skipFrames)) : null; public override bool Equals(object obj) => Equals(obj as StackTraceEntry);