public static void GetComponentChildren_Field_Test_NotUseAttribute() { GameObject pObjectParents = new GameObject(nameof(GetComponentChildren_Field_Test_NotUseAttribute)); // GetComponent 대상인 자식 추가 int iChildCount = (int)ETestChildObject.MAX; for (int i = 0; i < iChildCount; i++) { GameObject pObjectChild = new GameObject(((ETestChildObject)i).ToString()); pObjectChild.transform.SetParent(pObjectParents.transform); pObjectChild.AddComponent <Test_ComponentChild_ForPerformance>(); } const int iTestDummy = 50000; for (int i = 0; i < iTestDummy; i++) { GameObject pObjectChild = new GameObject(i.ToString()); pObjectChild.transform.SetParent(pObjectParents.transform); pObjectChild.AddComponent <Test_ComponentChild_ForPerformance>(); } GetComponentAttribute_PerformanceTest pParents = pObjectParents.AddComponent <GetComponentAttribute_PerformanceTest>(); pParents.GetComponentsInChildren <Test_ComponentChild_ForPerformance>(); pParents.GetComponentsInChildren <Transform>(); pParents.GetComponentsInChildren <Transform>(); // GameObject }
public static void GetComponentChildren_Field_Test() { GameObject pObjectParents = new GameObject(nameof(GetComponentChildren_Field_Test)); // GetComponent 대상인 자식 추가 int iChildCount = (int)ETestChildObject.MAX; for (int i = 0; i < iChildCount; i++) { GameObject pObjectChild = new GameObject(((ETestChildObject)i).ToString()); pObjectChild.transform.SetParent(pObjectParents.transform); pObjectChild.AddComponent <Test_ComponentChild_ForPerformance>(); } const int iTestDummy = 50000; for (int i = 0; i < iTestDummy; i++) { GameObject pObjectChild = new GameObject(i.ToString()); pObjectChild.transform.SetParent(pObjectParents.transform); pObjectChild.AddComponent <Test_ComponentChild_ForPerformance>(); } // 자식을 전부 추가한 뒤에 페런츠에 추가한다. GetComponentAttribute_PerformanceTest pParents = pObjectParents.AddComponent <GetComponentAttribute_PerformanceTest>(); GetComponentAttributeHelper.DoUpdate_GetComponentAttribute(pParents); Check_Dictionary(pParents.p_mapTest_KeyIsEnum, iChildCount); Check_Dictionary(pParents.p_mapTransform_KeyIsEnum, iChildCount); Check_Dictionary(pParents.p_mapGameObject_KeyIsEnum, iChildCount); Assert.NotNull(pParents.p_pChildComponent_FindEnum); Assert.NotNull(pParents.p_pChildComponent_FindString); Assert.NotNull(pParents.p_pObject_FindString); Assert.NotNull(pParents.p_pObject_FindEnum); }