Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Punkjim420 · Aug 10, 2015 at 01:58 AM · prefabsvariablesonlineefficiencycount

How many variables can i have of type 'Prefab' in a scene at one time?

I'm making a game with a lot of items. Things like apples, clothing, and even scene props like trees and houses. I made it so that I have non-3D versions of each item. So when I click on the 3D apple, it disappears and a button labeled "apple" appears in my inventory.

To get this to happen, I needed a prefab of the model I wanted to instantiate to be linked to my player object.(who also has my inventory script)

So the question is, is this a good way to do things? I mean if I have 500 prefabs that are all linked to my player object and all of the prefabs are of the 3D counterparts to my inventory items, would it make my scene lag?

I don't plan to allow there to be too many objects spawned at one time or even when I'm not spawning anything at all, I'm separating my world into parts and loading only the closest parts so that I can not have too many things at once. I'm just worried linking all the objects in the game to my player would be bad. I'm Also making multiple players in a games(online game) So I have considered making this "list" of objects a separate item that only gets loaded once, by the local player, for only the local player. Sorry for typing so much. I'm terrible with words. Thank you for reading! Any advice on this?

Comment
Add comment · Show 3
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 Punkjim420 · Aug 10, 2015 at 02:48 AM 0
Share

That's an idea! Thank you. To be honest, I forgot that unity allowed me to see the current FPS and ram usage of my game. I will definitely try that. If you want to convert to answer I would accept your response.

avatar image getyour411 · Aug 10, 2015 at 02:51 AM 0
Share

I'm a little confused by your description of the inventory - are the non 3D versions Sprites? You might setup a little Class / Struct that holds the Sprites and just set the Inventory ones to match up your UI element, only referencing the ones you have.

avatar image Punkjim420 · Aug 10, 2015 at 03:04 AM 0
Share

I have a custom class named Item, all my items are new instances of my item class. they are collected in a List<> and displayed as Buttons. public class Item {public string itemName { get; set; }} Button displays the item.itemName for identification currently.

1 Reply

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

Answer by Vice_Versa · Aug 10, 2015 at 02:19 AM

I think the best way to find out is to just see how many you can spawn before the fps starts to go down. I think the answer depends on how big the prefabs are

Comment
Add comment · Show 1 · 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
avatar image getyour411 · Aug 10, 2015 at 06:48 AM 0
Share

Converted and accepted per OP

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

25 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

Related Questions

Scripts/buttons getting old (prefab?) values of variables 1 Answer

Increasing through a list after an object has been destroyed 2 Answers

2D Openworld transport game. How to generate the tracks? 0 Answers

Set variables from a prefab 0 Answers

how do variables vs constants work in compiled code? 2 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