unity find object by name
C#
GameObject obj = GameObject.Find("/Parent/Child/ChildOfChild");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 Hand.
// Hand must not have a parent in the Hierarchy view.
hand = GameObject.Find("/Hand");
// This returns the GameObject named Hand,
// which is a child of Arm > Monster.
// Monster must not have a parent in the Hierarchy view.
hand = GameObject.Find("/Monster/Arm/Hand");
// This returns the GameObject named Hand,
// which is a child of Arm > Monster.
hand = GameObject.Find("Monster/Arm/Hand");
}
}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 Hand.
// Hand must not have a parent in the Hierarchy view.
hand = GameObject.Find("/Hand"); // This returns the GameObject named Hand,
// which is a child of Arm > Monster.
// Monster must not have a parent in the Hierarchy view.
hand = GameObject.Find("/Monster/Arm/Hand"); // This returns the GameObject named Hand,
// which is a child of Arm > Monster.
hand = GameObject.Find("Monster/Arm/Hand");
}
}
Also in C#:
- Title
- test how catch exception c#
- Category
- C#
- Title
- native-googlesignin configuration is null!?
- Category
- C#
- Title
- mvc write to console
- Category
- C#
- Title
- unity how to change the text on a button
- Category
- C#
- Title
- unity lerp
- Category
- C#
- Title
- create dropdown in datatable c# dynamically
- Category
- C#
- Title
- c# cheat sheet
- Category
- C#
- Title
- c# set textbox text
- Category
- C#
- Title
- how to make % posibility to spawn an object C# in unity
- Category
- C#
- Title
- how to find the area of a circle
- Category
- C#
- Title
- c# get enum value from string
- Category
- C#
- Title
- modificare una strinfa in c#
- Category
- C#
- Title
- c# build string out of list of strings
- Category
- C#
- Title
- unity making homing missile
- Category
- C#
- Title
- how to initiate a varaible in cs
- Category
- C#
- Title
- parsing string to int without format exception c#
- Category
- C#
- Title
- copy a list C#
- Category
- C#
- Title
- wpf binding ancestor codebehind
- Category
- C#
- Title
- convert array to list Unity C#
- Category
- C#
- Title
- nullable unique constraint ef
- Category
- C#
- Title
- unity quaternion
- Category
- C#
- Title
- what data type should be for contact number in asp.net
- Category
- C#
- Title
- c# check if argument null
- Category
- C#
- Title
- MVC creating a counter for products
- Category
- C#
- Title
- c# reverse string
- Category
- C#
- Title
- unity how to see what scen you are in
- Category
- C#
- Title
- Add component object to gameobject unity
- Category
- C#
- Title
- c# groupby date
- Category
- C#
- Title
- get hash c#
- Category
- C#
- Title
- eager loading vs lazy loading c#
- Category
- C#
- Title
- C# foreach loop async but wait at end
- Category
- C#
- Title
- interpolate rotation unity3d
- Category
- C#
- Title
- collision detector unity c# 2d
- Category
- C#
- Title
- letter at index of string c#
- Category
- C#
- Title
- c# date
- Category
- C#
- Title
- set label position winforms
- Category
- C#
- Title
- formula calculating distance coordinates latitude longitude c#
- Category
- C#
- Title
- format string to date only c#
- Category
- C#
- Title
- how to add movement in unity
- Category
- C#
- Title
- unity c# change color of gameobject
- Category
- C#
- Title
- c# store generic type without arguments
- Category
- C#
- Title
- c# loop through object
- Category
- C#
- Title
- epplus excel vb.net
- Category
- C#
- Title
- c# print expression tree
- Category
- C#
- Title
- add getenumerator to class c#
- Category
- C#
- Title
- c# to vb.net
- Category
- C#
- Title
- c# append array
- Category
- C#
- Title
- external font family uwp c#
- Category
- C#
- Title
- how to trim path in C#
- Category
- C#
- Title
- how to access the dictionary from another script in unity
- Category
- C#
- Title
- how to pass object as test case in nunit c#
- Category
- C#
- Title
- c# string list contains
- Category
- C#
- Title
- c# implement ienumerable t
- Category
- C#
- Title
- c list add element
- Category
- C#
- Title
- c# discord bot
- Category
- C#
- Title
- unity to integer
- Category
- C#
- Title
- c# reverse a string
- Category
- C#
- Title
- c# convert to int
- Category
- C#
- Title
- membership get user id
- Category
- C#
- Title
- access dic by key c#
- Category
- C#
- Title
- c# unity rotate first person controller script
- Category
- C#
- Title
- c# add object to array
- Category
- C#
- Title
- c# convert Unix time in seconds to datetime
- Category
- C#
- Title
- drag object unity 2d
- Category
- C#
- Title
- enums c#
- Category
- C#
- Title
- unity scene name get
- Category
- C#
- Title
- unity prevent system from creation
- Category
- C#
- Title
- unity vector3 to array
- Category
- C#
- Title
- c# file exist
- Category
- C#
- Title
- how to remove space between string in c#
- Category
- C#
- Title
- c# warning CS0108
- Category
- C#
- Title
- date time heutiges datum
- Category
- C#
- Title
- unity c# foreach
- Category
- C#
- Title
- c# region tag
- Category
- C#
- Title
- c# function return
- Category
- C#
- Title
- c# sql duplicate key exception
- Category
- C#
- Title
- fahrenheit to celsius c#
- Category
- C#
- Title
- unity indestructible
- Category
- C#
- Title
- dont destroy on load unity
- Category
- C#
- Title
- vb.net drag window without titlebar
- Category
- C#
- Title
- comments unity c#
- Category
- C#
- Title
- unity simple fps controller
- Category
- C#
- Title
- asp.net c# set session timeout
- Category
- C#
- Title
- c# arraylist contains
- Category
- C#
- Title
- unity how to make a ui disappear
- Category
- C#
- Title
- jumping with character controller unity
- Category
- C#
- Title
- c# round to closest multiple
- Category
- C#
- Title
- unity monobehaviour
- Category
- C#
- Title
- c# list get sublist
- Category
- C#
- Title
- c# edit element in list
- Category
- C#
- Title
- c# getter setter
- Category
- C#
- Title
- c# uppercase string
- Category
- C#
- Title
- reload current scene unity
- Category
- C#
- Title
- first sentence letter capital in c#
- Category
- C#
- Title
- chase object unity
- Category
- C#
- Title
- dynamic in c#
- Category
- C#
- Title
- remove from list based on condition c#
- Category
- C#
- Title
- when do i need to end a sentence with ; in c#
- Category
- C#
- Title
- c# combobox datasource enum
- Category
- C#
- Title
- c# loop datatable rows
- Category
- C#