Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Hydropulse17 · Apr 05, 2016 at 01:28 PM · prefabefficiencycpu usageadvanced

Efficiency of accomplishing everything with fewer scripts

I wrote a beautiful script. It's the longest and most complicated I've ever written. It's probably not that advanced, but I used several enumerators, for example, which I've never used before, and it was pushing my brain to it's limits.

The script selects one of three meshes at random, selects one of three sizes at random or decides which size it needs to be based off the size of the object instantiating it. It moves the game object in a random direction, and rotates it in a random fashion. And a bunch of other smaller things. I did this some what for the sake of learning new techniques, but I also thought it would be neater to have one object prefab, and one script to change it up a lot instead of having many prefabs(like small with mesh 1, small with mesh 2, small with mesh 3, medium with mesh 1...).

I had many hardships that could have been avoided by using many prefabs, but I don't regret my decision to use one. But I am curious? Which requires more computational power?

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 meat5000 ♦ · Apr 05, 2016 at 01:46 PM 0
Share

This is a best-practise/discussion question and actually belongs on the forum.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by meat5000 · Apr 05, 2016 at 01:45 PM

More objects is more intensive, script wise, due to the overhead associated with each one.

Having more scripts is kind of like appending them functionally end to end as that's what eventually becomes of them, so to speak. If each object is running a script the overheads will eventually mean that there is more processing to be done for the same amount of actual script. If your one big script does not put a strain on the FPS then there is no issue with it.

Systems can handle millions of processes per second. What brings the FPS down is where loops and expensive calls or operations are involved. If an operation is particularly expensive it will notably mention it in the docs.

If your approach works, don't over analyze it.

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

49 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

Related Questions

Minimizing spikes in Profiler? 0 Answers

Can I change each prefab clone for different value ? 1 Answer

Car permeates through the terrain 1 Answer

Newly Instantiated Prefabs Not Changing Colour 1 Answer

Event called on prefab instantiate 1 Answer


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