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 powdered_swords · Jun 28, 2013 at 05:31 AM · camerarendertexturecamera.render

Why does Camera.Render only work when rendering to RenderTextures

I'm not sure whether this is intentional or if I'm doing something wrong on my end but I can't seem to manually render to the game view. My scene consists of two cubes and a camera. I have this script attached to the camera;

 public class CameraRenderTest : MonoBehaviour {

 public GameObject ObjectA;
 public GameObject ObjectB;
 
 // Update is called once per frame
 void Update () {
     ObjectA.layer = 0;
     ObjectB.layer = 9;
     camera.Render();
     ObjectA.layer = 9;
     ObjectB.layer = 0;
     camera.Render();
 }

}

The Camera component is disabled to avoid automated rendering. I have the culling mask set to the default layer and the clear flag set to solid color. When I apply a RenderTexture to the camera both cubes are rendered to that texture along with the background. However if I leave the render texture field empty the game view stays blank. Again I'm not sure if this is a flaw with Unity or it was never intended handle what I'm attempting to do.

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 moonstruck · Jun 28, 2013 at 09:12 AM 0
Share

http://docs.unity3d.com/Documentation/ScriptReference/Camera.Render.html

Check the code example there. Camera.Render renders to the RenderTexture.active if the render texture is not specified.

avatar image powdered_swords · Jun 28, 2013 at 11:12 AM 0
Share

Thanks! I guess I'll have to render to texture then project that onto something.

avatar image Benproductions1 · Jun 29, 2013 at 03:20 AM 0
Share

@powdered_swords Isn't that always the case? The camera renders something to a texture, which is then rendered onto the screen

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

Canvas interaction on render texture to message PhysicsRaycaster 1 Answer

Can a rendertexture be placed on top of an image? (Minimap help) 0 Answers

RenderTexture Mirror - Camera postion and rotation 1 Answer

RenderTexture and OnMouseEnter offset 0 Answers

How can I set the exact camera render size for render textures? 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