Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to add a component to a prefab and then save the prefab

Discussion in 'Scripting' started by TxAg03, Aug 6, 2015.

  1. TxAg03

    TxAg03

    Joined:
    May 20, 2015
    Posts:
    21
    Have a gameobject that has many levels of children and I need to add specific components to the children only, not the parents. I know how to do this by hand, but it takes a long time on larger gameobjects. I know how to add components to a gameobject in code, but the problem is, I don't know how to save that gameobject as a new, updated prefab.

    Any suggestions on how to save an updated prefab? (possibly with keeping the original prefab untouched)

    Any and all help is greatly appreciated. Thank you.
     
  2. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
  3. TxAg03

    TxAg03

    Joined:
    May 20, 2015
    Posts:
    21
    Thank you so much Cherno. Could have sworn I went down that path before with no luck, but this time it worked perfectly.