From 57cb33cca7153294936efddc2bf5cdae7251a778 Mon Sep 17 00:00:00 2001 From: i1 Date: Thu, 4 Oct 2018 00:25:09 +0300 Subject: [PATCH] namespace --- Scripts/Utilities/ExtentionMethods.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Scripts/Utilities/ExtentionMethods.cs b/Scripts/Utilities/ExtentionMethods.cs index 68220c4..cb39962 100644 --- a/Scripts/Utilities/ExtentionMethods.cs +++ b/Scripts/Utilities/ExtentionMethods.cs @@ -1,14 +1,15 @@ -using UnityEngine; - -public static class ExtentionMethods +namespace UnityEngine.UI.Extensions { - public static T GetOrAddComponent(this GameObject child) where T : Component + public static class ExtentionMethods { - T result = child.GetComponent(); - if (result == null) + public static T GetOrAddComponent(this GameObject child) where T : Component { - result = child.AddComponent(); + T result = child.GetComponent(); + if (result == null) + { + result = child.AddComponent(); + } + return result; } - return result; } }