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
0
Question by RampantStudios · Oct 28, 2010 at 07:23 PM · performanceselectionprojector

If a projector is told to Ignore all layers, is it effectively turned off?

Hey! I'm trying to increase performance here. The project at the moment includes a selection script (Drag and drop to select units) and to show that the unit is selected they have a ring around them, at the moment I am using a projector to do this.

Instead of adding and removing projectors all the time, is it worth just setting a projector to ignore ALL layers when its off and then set the layers to use when its on?

I'm guessing that if the projector doesn't have a layer to push out onto that it'll just turn itself off and save CPU, or am I wrong about that?

Cheers

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
3
Best Answer

Answer by skovacs1 · Oct 28, 2010 at 07:58 PM

I would say you're right, but I'm not 100% sure about the performance gain of masking all layers for a projector because that's fairly specific to the internals of the implementation of Projector. In theory masking all layers away should only cost the function calls to attempt projection and then to check the layers, depending upon the implementation Unity went with.

If you simply want to turn something off, why not just set active? Setting active does not destroy the object so you can still change it, but will stop any scripts on it and will cut the cost of rendering.

//Turn off projector.gameObject.active = false;

//Turn on projector.gameObject.active = true;

or for your specific case, you could disable just the Projector which will prevent it from projecting and should save you the cost of rendering/calculating the projections.

//Turn off (projector.GetComponent(Projector) as Projector).enabled = false;

//Turn on (projector.GetComponent(Projector) as Projector).enabled = true;

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 RampantStudios · Oct 28, 2010 at 08:44 PM 0
Share

This is very true, I literally coded that in just a moment ago and it worked a charm! Thanks Skovacs1

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

No one has followed this question yet.

Related Questions

Better Projector alternatives for object selection 0 Answers

How to render projector in front of walls but behind player? 1 Answer

Light or light projector? 0 Answers

Why is performance so slow in Unity 4.0? 0 Answers

Not a question - just some performance metrics for rendering from Unity scripts 0 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