Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Scripting Old Standard Asset GlowEffect.cs in Unity 5.4

Discussion in '5.4 Beta' started by MrEsquire, Mar 14, 2016.

  1. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I have used a effect in Unity 4.6 from the Standard Assets called GlowEffect.cs and after upgrading to Unity versions 5x, the effect disappeared and no longer supported. Now I have upgraded my 2D game to Unity 5.4 beta and when GlowEffect is used a "pink screen" appears. This is a mobile game project and the last thing that's bugging me before the game fully upgraded. Can anyone help me and make suggestions how to fix this issue, problem is a few scripts within game reference this.
    I'm not sure why Unity removed such effects without a full explanation, I know this is old topic but still can make it linked to Unity 5.4.

    Thank you.
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    reimport the folder where the script / shaders are and report the errors, it should show some.
     
    MrEsquire likes this.
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Hey you are correct;

    Code (CSharp):
    1. Assets/Plugins/Vectrosity/Image Based/GlowEffect.cs(55,88): warning CS0618: `UnityEngine.Material.Material(string)' is obsolete: `Creating materials from shader source string will be removed in the future. Use Shader assets instead.'
    2.  
    3. Assets/Plugins/Vectrosity/Image Based/GlowEffect.cs(94,79): warning CS0618: `UnityEngine.Material.Material(string)' is obsolete: `Creating materials from shader source string will be removed in the future. Use Shader assets instead.'
    4.  
    But I'm not sure what this means or how to use Shader assets instead?

    Edit and the Shader has this error:
    Both vertex and fragment programs must be present in a CGPROGRAM. Excluding it from compilation.
     
    Last edited: Mar 14, 2016
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    AFAIK eric needs to update that his end (Vectrosity) ?
    Creating a shader from a string is indeed depreciated. Probably the change from cg to ms hlsl compiler has caused the error. You will need a new shader. Best bet is to flush all the old shaders from Unity and import the new ones, which are up to date. Unity cannot upgrade shaders from an old project, so you should import the updated ones manually.
     
  5. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Spoke to Eric, seems this effect somehow got added to his folder and nothing to do with Vectosity, we have multiple programmers work on the project so someone might have accidentally moved it there. The project as mentioned was started in Unity 4.6x and the shader with script comes in.

    Standard Assets for Unity 4.6
    the https://www.assetstore.unity3d.com/en/#!/content/21064

    When 5x came out I noticed they released;

    Standard Assets
    https://www.assetstore.unity3d.com/en/#!/content/32351

    GlowEffect is completely gone, I cannot find information on which others been removed. Anyway even if they have been removed some guidance should have been given on how to upgrade these effects to Unity 5x

    Shaders are really a pain, anyway although this applies to all the 5x series, its only in Unity 5.3.3 -5.4 where the "Pink Screen" effect is visible.

    I dunno if I need edit the actual GlowEffect.cs script or the Shader itself to fix the issue?
    They do not have upgraded shader for 5x so that's why cannot simply import new assets.
     
  6. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'd suggest the bloom filter from unity's cinematic post, it's nice and easily controlled. It's based off kino bloom.
     
  8. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I think there are two issues present: In Unity 5.4 Beta 10

    Code (CSharp):
    1. Trying to create a material from string - this is no longer supported.
    2. UnityEngine.Material:.ctor(String)
    3. GlowEffect:get_blurMaterial() (at Assets/Plugins/Vectrosity/Image Based/GlowEffect.cs:94)
    4. GlowEffect:OnRenderImage(RenderTexture, RenderTexture) (at Assets/Plugins/Vectrosity/Image Based/GlowEffect.cs:199)
    5.  
    So to learn for myself: How would I change this and fix this firstly even if Pink Screen still visible?