Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Paulo-Henrique025 · Jan 24, 2013 at 07:26 PM · instantiateprefabs

How prefab the instance works?

Hi guys, let's say I have built a entire city made of different blocks.

  • Each block is a prefab.

  • Each block has some buildings that
    are also prefabs or just models.

When in game I don't want the entire city loaded, only the blocks around the player will be alive. Here is my doubt, Unity does not have until now a "Prefabs of Prefabs" system, when I instantiate a new different block that has some models that are already used in other prefabs does Unity knows that these are the same ones?

I must know because I'm aiming for mobile, and there can be no waste of RAM/VRAM.

Thanks in advance.

Comment
Add comment · Show 4
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 Hyperion · Jan 24, 2013 at 09:20 PM 0
Share

Yes, Unity should know that the objects are all clones of one prefab (thus if you change the prefab, the clones will change, too). But I'm not sure that you can affect all prefabs at the same time in-game.

avatar image Hyperion · Jan 24, 2013 at 09:54 PM 0
Share

Good answer!

avatar image Paulo-Henrique025 · Jan 24, 2013 at 10:19 PM 0
Share

Thanks for the answer @sparkzbarca, can you post ir as a real answer?

I was forgetting the basics from my C++ days, unity for sure knows that X mesh and Z texture are already in the memory and don't reload them :)

avatar image Paulo-Henrique025 · Feb 01, 2013 at 06:47 PM 0
Share

@sparkzbarca please post your comment as an answer so I can mark it as the correct answer.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by sparkzbarca · Jan 24, 2013 at 09:40 PM

yes if you have a prefab that is

Prefab A + prefab B

and another that is

Prefab A + prefab C

of course it recognizes the connection between A in each. As long as you make sure your actually using the prefab in both.

if in the hierarchy you have it as A and B for one. A and C for the other. It will only have 1 instance of A in memory.

That is because a prefab is meaningless to the computer, its instituted for us not for the computer. To the computer prefabs dont exist, it just says draw A here and B here and A here and C here and has no need to group A and B together.

Basically we have difficulty with doing the same thing over and over again and perfectly every time. We make mistakes and forget.

But a computer sees no need for a prefab. A prefab is really a relationship formed between multiple objects as it relates to there position/scale because remembering to set each position and each scale everytime would be tedious and difficult. Writing spawn prefab A is alot easier to do and get right everytime than spawn object A then spawn object B so far away. Then scale A to B by so much, and doing that every single time.

But that is in fact what a computer does. It replaces your prefab with lots of tiny little instructions like that. Cause it has no problem repeating those instructions over and over again perfectly even without a frame of reference to compare it against.

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.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

How can I instantiate two prefabs at different times and positions ? 1 Answer

Instantiate Pre-fab clone altered on Instantiate 2 Answers

Different prefab getting instantiated? 1 Answer

Replace instantiated objects in an array 1 Answer

Instantiate prefabs working in editor but not in builds 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