Reply To: Material(string) is Obsolete

Home Forums Books Mastering Unity 2D Game Development Material(string) is Obsolete Reply To: Material(string) is Obsolete


Hi Fran

Thanks for reaching out. Your query really had me scratching my head for a while as I had done a fix for this issue but couldn’t find where I had written it up, until I found it.

Basically, the original book was written in the 4.x timescales. Once Unity 5 came out, changes were optionally needed as a few warnings appeared but didn’t stop anything from running. That was until they changed the Shader pipeline and prevented using Shader strings (as used on Page 110).

There is a post which I keep up to date on the forum titled “Unity 5 Support” which details any and all changes required to run the project on Unity 5 (I have to keep it up to date as Unity keep changing things on me :D)

The particular update you are looking for is detailed here:

This walks you through changing the shader segment from a text based material shader to a shader resource (basically taking the text and creating an actual shader file with the same code) and then referencing the new shader in code.

Hope this helps and good luck on your game coding adventure.

Be sure to check the rest of that thread regarding Unity 5 updates.

Simon (Darkside) Jackson