Находит объект с именем name и возвращает его.
This function only returns active GameObjects. If no GameObject with name can be found, null is returned. If name contains a '/' character, it traverses the hierarchy like a path name.
вместо этого, при запуске кэшируйте (храните) результат функции в поле или используйте GameObject.FindWithTag.
Note: If you wish to find a child GameObject, it is often easier to use Transform.Find.
Note: If the game is running with multiple scenes then Find will search in all of them.
using UnityEngine; using System.Collections;
// This returns the GameObject named Hand in one of the Scenes.
public class ExampleClass : MonoBehaviour { public GameObject hand;
void Example() { // This returns the GameObject named Hand. hand = GameObject.Find("Hand");
// This returns the GameObject named