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
1
Question by brainzizizi · Dec 25, 2010 at 09:45 PM · iphonegenericssettersgetters

C# generics and getters/setters with Unity iPhone

Is there any reason why I shouldn't use generics and/or getters and setters in Unity for iPhone?

Any performance hitsI should be expecting?

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 Peter G · Dec 25, 2010 at 10:22 PM 0
Share

Nothing unexpected. Generics lists and dictionaries are probably faster than there non-generic counter parts.

avatar image Jessy · Dec 25, 2010 at 10:32 PM 0
Share

It depends by what you mean by counterparts. They're not as fast as built-in arrays, but built-in arrays are only good when you don't need reshuffling of data. Definitely go with Lists over ArrayLists, though. As for getters/setters being faster than what? functions?, I have no idea, but I highly doubt the difference would make any real-world difference, and using a property ins$$anonymous$$d of a function can make for more readable code.

avatar image brainzizizi · Dec 25, 2010 at 10:47 PM 0
Share

Since I don't understand the compiling process fully I though there might be some extra work involved with using get and set. But if getters and setters compile into functions I guess no harm in using them than. AFAI$$anonymous$$ built in arrays are cheaper than generic lists but I'm not talking about hundred of items per list. I'm more interested in making my code more readable. Thanks for the input!

1 Reply

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

Answer by Jessy · Dec 25, 2010 at 10:26 PM

No.

However, in my experience, if you use too many C#-specific features, such as what you mentioned, event handlers, and lambda expressions, the game won't run on the device, despite running fine in the Editor. You'll get a SIGABRT error, and one frame won't even be rendered (as can happen with a SIGBUS). The Unity logo will be seen, if you don't have Pro, but that's it. Support has not been able to give me any guidelines on this. Everything works in isolation; it comes from everything adding up, as far as I can tell. Because I can't run a game that I put a lot of work into already, I am starting a new project, with the assumption that this will happen, as it gets more complex; I will be building frequently, trying to identify the straw of code that breaks the Unity iOS's back. I will try to remember to update about that, here, when it happens.

Comment
Add comment · Show 3 · 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 brainzizizi · Dec 25, 2010 at 10:53 PM 0
Share

Interesting. So no big deal if I use a list every now and then but I should't overdo it with C# specifics. Thanks for the insight Jessy.

avatar image brainzizizi · Dec 25, 2010 at 10:56 PM 0
Share

I hope you solve your C# problem soon. Good luck!

avatar image nventimiglia · Oct 02, 2013 at 12:37 AM 0
Share

Can you define "Too $$anonymous$$any" ?

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

1 Person is following this question.

avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Properties names, same as class okay or bad? 1 Answer

How do I invert the Y axis in Penelope tutorial? 3 Answers

Accessing class properties through getters & setters in editor mode 1 Answer

How could I create a dynamic cartoon style speech bubble? 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