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 /
avatar image
5
Question by Diet-Chugg · Sep 03, 2011 at 09:45 PM · librarypragma

what is #pragma

So I have been trying to figure out what #pragma does. It looks like it calls some libraries but I am not sure. If it is calling libraries, what are available libraries for use and what do these libraries do?

 #pragma strict
 #pragma implicit
 #pragma downcast

Thanks in advance everyone!

Comment
Add comment
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

1 Reply

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

Answer by yatayata · Sep 03, 2011 at 11:57 PM

pragma is a pre-compiler directive. ie it tells the compiler what to do or how to behave.

eg #strict - "be uptight when you compile this schizzle bro!"

Comment
Add comment · Show 10 · 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 unluckyBastard · Sep 04, 2011 at 12:01 AM 0
Share

They're also very helpful in optimizing your game.

avatar image Diet-Chugg · Sep 04, 2011 at 01:53 AM 0
Share

how are they helpful in optimizing?

avatar image SisterKy · Sep 06, 2011 at 08:27 PM 1
Share

by being strict. they won't allow you to do as dirty code.

e.g. when defining a variable without #pragma you can leave out the typing and unity will figure out what the variable 's supposed to be when you use it. But the 'figuring out'-part can take a lot of resources. That's why it's considered bad habit / dirty code to not always type stuff. With #pragma you must tell of what type the variable will be and it will give you an error if you don't comply.

Greetz, $$anonymous$$y.

avatar image POLYGAMe · Feb 17, 2012 at 01:29 AM 0
Share

Greta, now I now... the new version of $$anonymous$$onoDevelop includes #pragma strict on all new scripts. This will keep me on my toes ;-)

avatar image Eric5h5 · Feb 17, 2012 at 01:45 AM 0
Share

It's Unity 3.5 that includes #pragma strict for new scripts, not $$anonymous$$onoDevelop.

Show more comments

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

10 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

Related Questions

What is the function of the #pragma commands 1 Answer

Non traditional Shader, for adding saturation 0 Answers

Problem loading XML files after build using .NET libraries 1 Answer

Unity Library folder vs. Source control 2 Answers

How to link a library in Unity 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