• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by UncleLeo · Sep 01, 2021 at 05:14 PM · prefabs

Can someone help me understand prefabs?

Every time I take a course on Unity everything goes smoothly until I get to prefabs. Here I am for the 3rd and final time about ready to just give up all together. I'm making a simple block breaker game. I have a block. I've turned it into a prefab. But when I add the prefab to the hierarchy or to the scene, it's just a clone, I can't edit the prefab and have it edit the "clone" so I have to edit every single one individually. What am I doing wrong?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bonfire-Boy · Sep 02, 2021 at 12:20 AM 0
Share

It definitely is possible to drag a prefab into a scene to create instances of it, which retain connection to the prefab so that edits to the prefab impact on the instances (unless you've overridden properties in the scene instance). But this only works at edit time - if you create instances of prefab at run-time they're just clones of the prefab with no connection to it. So it sounds like maybe that's what you're doing...?


For me, the key thing to understanding prefabs is that a prefab is simply a text file providing a recipe for creating a game object. And a scene is a text file providing a recipe for constructing a scene A scene's text file can contain a section saying "make an object using recipe X". The section can also specify overrides for values inherited from the prefab's recipe (so then it becomes "make an object using recipe X then change these values"). And so if you change the prefab file, anything that you change gets changed in all the objects made from it. BUT... all that is edit-time stuff. As soon as you press Play in the editor, or run the scene in a build, those objects are created according to the recipes-with-overrides and from that point on they're just independent objects.


If the above doesn't help I think maybe you need to provide more detail about what you're doing. Edit time? Run time? How are you "editing the prefab"? What do you mean by "add the prefab to the hierarchy or scene"? And so on. Also note that the hierarchy is just a representation of what's in the scene, so that last quote confuses me a little)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TheJimmyJ57 · Sep 01, 2021 at 05:31 PM

Hello there, recent Unity learner here myself. From my understand, prefabs are a game object that you can continually instantiate in your scene. The prefab will have all the properties you need it to have to interact with your environment. In your mention of block breaker, you presumably want different blocks to be different colors or have different point values for breaking as well as other properties. To do this, I believe you want to explore prefabs variants. Its a similar idea, although you can create and instantiate different variants of the same core object. Hope that helps.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

132 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't drag and drop prefabs made by other people on my team (Git/Git LFS) 0 Answers

Animation for all instantiated prefabs to the same position 0 Answers

What would be the best way to make large amounts of similar collectible objects (+600)? 0 Answers

Particle system prefab not instantiated 1 Answer

Is there a recommended workflow to pre-process prefabs before making a build? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges