0
Planlagt
Cubemap assets not marked for read/write will break shader loading
Admin edit: Original title was "Duplicating shader in unity - Alpha 0.13 (w7-x64)"
Original post below:
After having duplicated a ShaderForge created shader in unity all the connections between my nodes are lost. Both in the old (original) and the newly duplicated shader.
Kundesupport af UserEcho
A short follow up. This duplicaion seems to have contaminated the shader. No connections are stored in my shader any more. Every time I open it there are just nodes, no connections.
Does this happen to new shaders? Did your old shader use tessellation/Displacement?
What are you referring to when you say new shaders? I have yet to run into an instance where it doesn't occur. If you are thinking of shaders from previous projects, or from older versions of ShaderForge I can't say. As I've just started using your software I can only talk of my current project.
No, there was no tessellation or displacement involved. I even copied the non-working shader onto my desktop to save it from this, but that did not seem to help either.
If I can provide you with any other kind of help please let me know! Or if you want me to do some kinds of tests.
Odd - could you upload the shader to http://pastebin.com/ ?
Also, which version of Unity are you running? You need 4.2 or later
Here it is:
http://pastebin.com/HEAUYwU5
I'm running 4.2.1f4
Maybe it's not actually related to the duplication as opening yesterdays working shader shows a now broken one. But some of my shaders have kept their connections.
Strange. I can open it somewhat fine here, even though the save system was slightly changed for 0.14. If you create a new shader, without any textures inside, save, and load, does it work? And does it work if you do use a texture in it?
That sounds very strange indeed. I forgot to add that I'm on Unity Pro right now.
I tried two different ways of creating a new shader,
right-click >> create shader
Open the shader in mono develop and paste the code from pastebin
Open shaderforge and create new shader, save and close.
Open the new shader in monodevelop and paste the code from pastebin
Both list all my possible inputs in the Inspector but none of them has any connections when I open them in shaderforge
One of these new shaders applied to one of my meshes produce a working result but when I open it in shaderforge again and compile it breaks.
When you open the shaders that break, do you get any errors in the console?
Yes, actually I did (still learning to check all the places in unity):
--------------------------------------
UnityException: Texture 'Night' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
UnityEngine.Cubemap.GetPixels (CubemapFace face) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/Editor/Graphics.cs:1054)
ShaderForge.SFN_Cubemap.RenderToTexture ()
ShaderForge.SFN_Cubemap.DeserializeSpecialData (System.String key, System.String value)
ShaderForge.SF_Parser.ParseNodeRow (System.String row)
ShaderForge.SF_Parser.LoadFromNodeData (System.String data)
--------------------------------------This Texture, Night is a skybox but has Readable Ticked so I don't know why it's like that?
The attributes of the file are correct too, no read-only attribute in windows either.
It's trying to get one of the faces of the cubemap - are all faces marked as readable as well?
I don't seem to be able to change the readability on the individual faces of the cubemap. The textures linked to the cubemap have no such setting either and the files in windows all have correct read/write attributes.
Does it happen to shaders without a cubemap node?
Recreating the same exact shader in shaderForge but leaving all the input nodes empty creates a shader that has no problem whatsoever.
However when I specify that the Night cubemap should load inside of shaderForge it breaks. But the previous shaders that have no inputs specified are still working fine.
So, I've been lying a bit. My files weren't readable at all. The tickbox for the skybox's readability was hidden due to a somewhat smaller inspector pane (great work in usability Unity!).
So the bug is understandable now, the connections are lost once a file isn't readable.
Cool, I got the issue then! I will have to add some warning instead of allowing the entire parsing process to crash :)
Thanks for the help debugging this!
Glad to be of assistance!