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 ronronmx · Mar 12, 2012 at 08:01 AM · editoreditor-scriptingeditorwindow

SetReplacementShader in Editor Utility?

Hi folks! I'm trying to write an editor script that would let me use a replacement shader to render the editor - or game - view using a different shader for all my object.

Problem is, this can only be done through a camera, for example, Camera.SetReplacementShader(myNewShader, "RenderType"). This works for the game view, but not for the editor view.

How can I make it work in the editor view?
Thanks for your time!

Stephane

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 · Mar 12, 2012 at 08:20 AM 0
Share

I was sure there was some kind of hack to get a reference to the 'editor camera'... I'll look it up, might be wrong.

avatar image syclamoth · Mar 12, 2012 at 08:25 AM 0
Share

How about this: try using 'OnPreRender' and Camera.current. It's possible that that gets called for editor cameras too, but I might be wrong. Give it a shot, anyway!

avatar image ronronmx · Mar 13, 2012 at 05:54 AM 0
Share

Thx for the help syclamoth! Unfortunately this didn't work, as 'OnPreRender' only works if the script is attached to a camera. $$anonymous$$aybe I'm co$$anonymous$$g at this the wrong way...all I want to do is use a different shader which supports lights (surface shader for example) so that I can see what the scene looks like all lit, ins$$anonymous$$d of having to render a lightmap just to see if it's the way it's supposed to be.

avatar image syclamoth · Mar 13, 2012 at 05:56 AM 0
Share

Damn, oh well. Wait, what? Is your scene always lit by lightmaps, or does it use realtime lights? You can enable and disable lighting in the editor window, is it that?

avatar image ronronmx · Mar 13, 2012 at 05:51 PM 0
Share

Yeah I know what you mean, and no i am not using lightmaps right now, just realtime lights, and yes the lighting is enabled in the editor, and my lightmaps are all cleared. This is a though one :)

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How can i get the center of the entire editor window 0 Answers

Editor window script only works when window is open? 1 Answer

What is the best way to draw icons in Unity's Hierarchy window? 1 Answer

Editor window doesn't open 2 Answers

How do I code my own custom built blend tree node as seen in the Animation Controller Editor Window? 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