- Home /
How can I select a child of a prefab and use it in the inspector for another object?
I have object A, and inside of it is a script that wants an object. I have object B, and it is a child of a prefab. I want to put object B in the inspector window of object A. If I select the prefab (parent of object B), unity will open the prefab scene, and I can no longer access the inspector of object A (, meaning that I cant place it inside). How can I place a child of a prefab inside the inspector of a completely different object?
i think you are double clicking on object in inspector.. click once on it you can see its child .. you can also lock your inspector for gameobject A and then drag and drop child of b on it!
Answer by cgklutts · Dec 18, 2019 at 12:53 AM
There is a lock icon in the top right corner to lock the inspector so you can click other stuff without it changing
It doesn't let me place an object if I lock inspector and open the prefab scene. I can't even put a prefab in there (when I normally could outside of prefab scene).
Answer by smailessaadi · Mar 12 at 02:24 AM
@lowhearted you can make the child a prefab by itself and assign it.
Answer by darkforceyoda · Mar 12 at 08:56 PM
[serializedfield] GameObject _prefab;
[serializedfield] X _whatYouWant
_prefab = gameObject.find("prefab")
_whatYouWant = _prefab.gameObject.transform.getChild[0]
child count starts with 0 for fist item.
Your answer
![](https://koobas.hobune.stream/wayback/20220612220321im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rescaling a prefab - geometric object with hole in middle 0 Answers
Referencing / linking a .asset / .prefab file in another .asset / .prefab file programmatically. 2 Answers
Changes made in prefab mode via script aren't marking the object as Dirty 1 Answer
Prefab can't select target Prefab 1 Answer
How can I access the 2nd tier of children on a prefab in the Project Folder Window? 4 Answers