• 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 Wahooney · Jan 04, 2012 at 11:04 PM · camerarendererrender

Set renderable objects on camera without Layers

I need a camera to render only specific objects/renderers when I call the Camera.Render() function. Is it possible to do that without using render layers?

The best solution I can come up with is to move the object 100000 units away (or somet$$anonymous$$ng) and then render it with a smaller far clip, but that's awfully hacky.

Comment
Add comment · Show 5
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 syclamoth · Jan 05, 2012 at 08:01 AM 0
Share

So, what's wrong with using render layers? It's like asking "I want to nail together this box, but I don't want to use a hammer"

avatar image Wahooney · Jan 05, 2012 at 10:20 AM 0
Share

Because sometimes you need a screw ;)

If I use render layers I will either have to have a layer that's always reserved for an action that will not run that frequently or assign a layer to each object and camera pair, which is more than a little silly.

I will mostly render a single object to a camera and reserving a render layer for that seems a bit excessive.

I can work with the reserved layer thing, however, ideally I'd like to say something like: Camera.Render(Renderer[]); which doesn't exist obviously but it would be nice.

avatar image syclamoth · Jan 05, 2012 at 10:27 AM 0
Share

Why, exactly, are you doing this? What's the desired outcome?

avatar image Wahooney · Jan 05, 2012 at 10:34 AM 0
Share

I'm writing a system that will automatically convert any renderer into impostors. So I need to be able to render an object on it's own without outside interference. I've got most of it working, right now the biggest headache is the fact that multiple objects can be rendered when I just need to the one.

avatar image Slawo · May 25, 2015 at 10:06 AM 0
Share

I have a similar problem with multiple objects needing to be rendered on regular intervals on their own for later use. With OpenGL I put together a little routine I would attach to all the object that needed that, with Unity it seems impossible.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by msknapp · Jan 05, 2012 at 12:28 AM

For the objects you don't want to render, add code to t$$anonymous$$s effect:

GameObject myGameObject = ...
myGameObject.renderer.enabled=false;

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 Wahooney · Jan 05, 2012 at 07:15 AM 0
Share

I'm not keen on this solution, as I may need to turn renderers off for hundreds if not thousands of objects.

avatar image Slawo · May 25, 2015 at 10:06 AM 0
Share

This is a terrible idea in a scene which contains hundreds of little objects...

avatar image sewy Slawo · Dec 13, 2019 at 12:16 PM 0
Share

But is good enough if its just about few objects.

avatar image
0

Answer by WheresMommy · Dec 13, 2019 at 12:23 PM

I would set the layer on runtime to render for the objects you need and then revert.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

If I script something to render, can it be frustrum culled? 2 Answers

Render group of objects in front? 0 Answers

How do I force my cameras to render in a certain order in URP? 1 Answer

Shuriken won't render off camera bounds 0 Answers

How can I stop the drawcall of an object if it is not in view of the camera, without using occlusion culling? 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