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. Dismiss Notice

[SOLVED]AssetDatabase.CopyAsset not working as expected.

Discussion in 'Asset Database' started by Miggy, Jun 6, 2015.

  1. Miggy

    Miggy

    Joined:
    Feb 9, 2010
    Posts:
    76
    So I'm trying to do something that appears relatively simple but it doesn't work. I just want to copy a texture from one folder to another. Using AssetDatabase.CopyAsset() the texture is copied to the destination but the copy just shows up as an unrecognized file in Unity. The file size of the copy is the same so I think that data has been copied but Unity doesn't recognize it as a texture.

    Anyone run into this problem?
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Are you giving the new asset the same extension?
     
    Miggy likes this.
  3. Miggy

    Miggy

    Joined:
    Feb 9, 2010
    Posts:
    76
    That was it. Thanks for the tip!
     
    Kiwasi likes this.
  4. usernameHed

    usernameHed

    Joined:
    Apr 5, 2016
    Posts:
    92
    THANKS YOU