Search Unity

Access to the Resources folder [SOLVED]

Discussion in 'Editor & General Support' started by retrophil, Aug 5, 2019.

  1. retrophil

    retrophil

    Joined:
    Mar 16, 2013
    Posts:
    46
    I have some code that copy and pastes assets into the resources folder.

    Then I try to access these assets straight after I've added them when I'm not in play mode.

    Loading the resources works but accessing them doesn't. But if I run the same code again it does access the assets.

    I originally thought I just needed to update the Unity Editor with something like AssetDatabase.Refresh() or giving the editor some time by creating a coroutine or set it's thread to sleep.

    But none of this has any affect.

    EDIT: Turns out if I try to grab the assets directly from its variable it doesn't work even though the file is there.So I grabbed the references with Linq and it works.
     
    Last edited: Aug 5, 2019