public void Benchmark_ChildNotation_TrickyDeepScene() { SuperFindTestHelpers.CreateTrickyDeepScene(); var watch = new Stopwatch(); watch.Reset(); watch.Start(); for (int i = 0; i < REPS; i++) { SuperFind.Find("Root Child"); } watch.Stop(); var superFindTime = watch.Elapsed; watch.Reset(); watch.Start(); for (int i = 0; i < REPS; i++) { GameObject.Find("Root/Middle/Child"); } watch.Stop(); var nativeTime = watch.Elapsed; Debug.Log("Benchmark_ChildNotation_TrickyDeepScene: Time for GameObject.Find = " + nativeTime.TotalMilliseconds + "ms. Time for SuperFind.Find = " + superFindTime.TotalMilliseconds + "ms for " + REPS + " reps."); }
public void FindsBySiblingNotation_SiblingScene_first() { var target = SuperFindTestHelpers.CreateSiblingScene(6, 0); var result = SuperFind.Find("Child(Clone):first"); Assert.AreSame(target, result); }
public void CannotFind() { SuperFindTestHelpers.CreateSceneWithRoot(); var result = SuperFind.Find("Wrong"); Assert.IsNull(result); }
public void FindsByChildNotaton_TrickyDeepScene() { SuperFindTestHelpers.CreateTrickyDeepScene(); var result = SuperFind.Find("Root Child"); Assert.AreEqual("Child", result.name); }
public void FindsByExactName_DeepScene() { SuperFindTestHelpers.CreateDeepScene(); var result = SuperFind.Find("Child"); Assert.AreEqual("Child", result.name); }
public void FindsByName_WithSpaces() { SuperFindTestHelpers.CreateSceneWithSpacesInName(); var result = SuperFind.Find("\"Child With Spaces\""); Assert.AreEqual("Child With Spaces", result.name); }
public void FindsByExactName_Root() { SuperFindTestHelpers.CreateSceneWithRoot(); var result = SuperFind.Find("Root"); Assert.AreEqual("Root", result.name); }
public void FindsBySiblingNotation_MultipleSiblingsScene_5() { var target = SuperFindTestHelpers.CreateMultipleSetsofSiblingsScene(3, 6, 5); var result = SuperFind.Find("Child(Clone):5"); Assert.AreSame(target, result); }
public void FindsBySiblingNotation_SiblingScene_Index5() { var target = SuperFindTestHelpers.CreateSiblingScene(6, 5); var result = SuperFind.Find("Child(Clone):5"); Assert.AreEqual(target, result); }
public void FindsByExactName_Root_Inactive() { SuperFindTestHelpers.CreateSceneWithRoot(); GameObject.Find("Root").SetActive(false); var result = SuperFind.Find("Root"); Assert.AreEqual("Root", result.name); }
public void FindsByChildNotaton_DeepScene_Inactive() { SuperFindTestHelpers.CreateDeepScene(); GameObject.Find("Child").SetActive(false); GameObject.Find("Root").SetActive(false); var result = SuperFind.Find("Root Child"); Assert.AreEqual("Child", result.name); }
private void OnGUI() { _input = GUILayout.TextField(_input); if (GUILayout.Button("SuperFind.Find")) { GameObject found = SuperFind.Find(_input); if (found != null) { Selection.SetActiveObjectWithContext(found, null); } } if (GUILayout.Button("SuperFind.FindAll")) { GameObject[] found = SuperFind.FindAll(_input); if (found.Length != 0) { Selection.objects = found; } } }