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
2
Question by AndyP · Jul 03, 2012 at 01:04 PM · performanceoptimization

I want to know more about how Unity works, but how?

I'm sure I'm not the first person to ask this question, but I couldn't find any good topic about it, so I'm asking here.

I've been using Unity for a few weeks now and am loving it as it makes doing a lot of things very simple. However, there are a few things where I'll try to do something and Unity doesn't exactly behave as expected, or I end up doubting the efficiency of my implementation because I don't know what the Unity API functions are really doing when I call them.

For example, right now I'm making a small tower defence game as a learning exercise and want to get a list of n monsters within range x of a tower ordered by distance. This kind of thing seems like something that might be built into Unity, but I couldn't find anything quite that specific. However, there ARE functions that let us get a list of objects by type, or get objects within a sphere around a point. Doing this is easy and I have no problem writing my own code to then sort the list of objects as I need. However, I don't know how efficient that is because I don't know how Unity is getting the objects in the scene.

I don't need to know the really low level stuff, but it would be nice to know if Unity already performs spatial partitioning on objects in the scene to speed up finding objects within a range etc. or if I need to actually partition the scene and manage lists of objects myself. This is the kind of annoying code that I would rather not be writing so it would be great to know if it's something that's not necessary.

Another example is collision detection. Unity probably has very optimised collision detection routines in native code, but if I wanted to make a 2d bullet hell shooter and all my collisions are 2d points and boxes or circles, am I better off just doing it myself and taking the speed penalty of it being in a script? I'm asking because I think even the box collider is OBB, not AABB, so perhaps there is some large performance penalty there that I don't know about.

A friend and I also had a bit of trouble using the Networking in Unity, which might have been a little easier if we knew more about how it was working and what Unity was sending.

Sorry for the long post. If there is any good resource for finding out a little more about the internal workings of Unity, it would be fantastic and enlightening to have a look at it.

Comment
Add comment · Show 2
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 khellstr · Jul 03, 2012 at 01:13 PM 0
Share

I think this would get better answers/discussion in forum.

avatar image AndyP · Jul 03, 2012 at 01:23 PM 0
Share

You're probably right, but I can't seem to make a forum account at the moment. I didn't have one before Unity started the UDN, so I can't claim any account, but I don't want to lose this account. It seems to be impossible to create a forum account under an existing Answers only UDN account :(

Anyway, if anyone has any answers/opinions it would still be good to hear.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Kryptos · Jul 03, 2012 at 01:43 PM

You can take a look at Unity's DLL such as UnityEngine.dll. Open them with monodevelop (using the Library explorer) to see the CIL or an approximate of the corresponding C# code.

This helps me sometimes. For example you can see that GetComponent() is as efficient as GetComponents() because the first ones calls the second one and returns the first occurence.

Of course, most part of the DLL is only a wrapper around native call to the internal engine. So you may not go very deep.

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
avatar image
0

Answer by Baldinoboy · Jul 03, 2012 at 01:58 PM

Your way ahead of me in skill. So this answer might be stupid to you but you can learn everything that Unity has implemented in it in the Reference Manual on the Unity site. Read through that, which you might already have, and you'll learn everything Unity has to offer.

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

8 People are following this question.

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

Related Questions

(2 hidden skinned meshes) or (1 extra draw call) for character props? 2 Answers

Simple Animation showing as ~6.3 in Xcode console profiler 0 Answers

Is there a performance difference between Unity's Javascript and C#? 6 Answers

Are .gameObject and .transform both using GetComponent() in the background? 1 Answer

Add 2d rigidbodies to moving objects to increase performance or not? 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