- Home /
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
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.
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!
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.
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?
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 :)
Your answer
Follow this Question
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