Search Unity

Creating camera from script - how to load resource asset?

Discussion in 'Image Effects' started by tylerw-savatronix, Sep 6, 2018.

  1. tylerw-savatronix

    tylerw-savatronix

    Joined:
    Nov 10, 2013
    Posts:
    90
    Hi there,

    My camera is created at runtime via script. In the documentation it says when adding the PostProcessLayer component via script that it needs a reference to the resource file (I'm assuming it means PostProcessResource.asset found in the PostProcessing folder).

    Since it's not in a resources folder, and duplicating/copying (from within Unity at least) seems to be disabled on that file (so I can't, at least within Unity, duplicate it and move it into a resources file), how exactly am I supposed to go about getting the reference to it to send to PostProcessLayer.Init?

    Should I just copy the file in file explorer instead of through Unity to a resources folder and load it that way? Or is there supposed to be an actual intended way to get a reference to it at runtime?

    Thanks!
     
  2. MisterZhou

    MisterZhou

    Joined:
    Nov 9, 2013
    Posts:
    15
    Are there officials here?

    I also want to know why my script additions don't work.