Skip to content

Instantly share code, notes, and snippets.

@Hironyi
Last active June 17, 2021 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hironyi/60def3ca732a38d2ffae835ee7a7a1f1 to your computer and use it in GitHub Desktop.
Save Hironyi/60def3ca732a38d2ffae835ee7a7a1f1 to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class GetsComponentsTest : MonoBehaviour
{
private IEnumerable<TestClass> testClass;
// Start is called before the first frame update
void Start()
{
testClass=GetComponents<TestClass>();
Test();
}
public void Test()
{
testClass.ToList().ForEach(test=>test.Test());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment