Name of the prefab generated by Instantiate Create a program that is obtained by GameObject.Find () and the first prefab that was generated first points to the A object, the second prefab that is generated points to the B object ... doing.
I have to change the name of the generated prefab for each prefab, but I don't know how.
The way I think is
"If the object name in the hierarchy has a name of" 1 ", it will be named" 2 ". If it has a name of" 1 "," 2 ", it will be named" 3 "."
Is it possible to get the names of the objects in the hierarchy?
cube = (GameObject) Resources.Load ("Prefab);
GameObject hoge = Instantiate (cube, gameObject.transform.position, Quaternion.identity) as GameObject;
hoge.name = numbering;
↑ I write like this now.
Answer # 1
GameObject  gameObjects = FindObjectsOfTypeto get all game objects and check their names.
However, since all game objects are searched, the operation is slow.
Therefore, I think that it is better to prepare
Listor something, and manage the generated game object.
- c # - unity) show/hide prefab button conditionally
- c # - i want to get the number of characters with unity ui text
- c # - unity) i want to get the image size in prefab
- c # - [unity] i want to switch the clear flags of camera at specified intervals
- [c # unity] how to set arrey or dictionary in scriptableobject?
- number of polygons in unity's plane
- c # - about player prefs for unity
- [unity c #] how to completely stop walking when switching panels
- how to use tolist (): and linq;in unity c #
- c # - i want to keep the number of frames required for timing adjustment constant
- c # - when controlling ui in unity, there are times when you can access an instance of an object and times when you cannot
- unity - about the polygon number of the stage model
- c # - how to autorun after burning unity to dvd
- even if you use findindex while using list of unity c #, the index number cannot be obtained as expected
- c # - i want to know the file format that unity can call an external process in android environment
- read by specifying ip address and port number in c # udp communication
- c # - [unity] i want to pass a variable from onenddrag to ondrop
- c # - [unity] on the game screen, right-click menu display when an object is selected and when it is not selected
- c# - in unity, i want to instantiate the specified prefab as a child of the specified object
- c # - [unity ray cast] execute the function of the object that received the ray
- c # - steamworksnet-example imported for steam achievement gives an error
- c # - sound playback in a place different from the place where the unity hit detection occurred
- c # - screen transition is not possible in firebase, unity: statechanged
- c # - [unity] in ios, i want to prevent the game from stopping when the notification center or control center is opened
- c # - about character string match judgment
- c # - unity wall penetration&camera buried
- c # - i want to share variables from other scripts
- c # - i want to press a button to activate the timer so that an object will be created after a certain amount of time has passed
- c # - how to retrieve array data elements after udp communication using pico json
- c # - i want to create a prefabricated car (car waypoint based) that runs automatically in unity!