Skip to content

Commit

Permalink
Add own GetOrAdd method.
Browse files Browse the repository at this point in the history
Remove unnecessary using directives.
  • Loading branch information
hwi-middle committed May 4, 2022
1 parent fa74f96 commit 3f29e95
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
5 changes: 0 additions & 5 deletions Assets/JB STUDIO/EZ2Screenshot/Editor/EZ2ScreenshotWindow.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.WebPages;
using Unity.VisualScripting;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using UnityEngine;

public static class EZ2ScreenshotGameObjectExtension
{
public static T GetOrAddComponent<T>(this GameObject go) where T : Component
{
T component = go.GetComponent<T>();

if (component == null)
component = go.AddComponent<T>();

return component;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
Expand Down
3 changes: 0 additions & 3 deletions Assets/JB STUDIO/EZ2Screenshot/Scripts/EZ2ScreenshotObject.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Rendering;

[RequireComponent(typeof(Camera))]
public class EZ2ScreenshotObject : MonoBehaviour
Expand Down

0 comments on commit 3f29e95

Please sign in to comment.