Search Unity

Sub asset InstanceId will relative to main asset's InstanceID?

Discussion in 'Scripting' started by tinyant, Oct 18, 2018.

  1. tinyant

    tinyant

    Joined:
    Aug 28, 2015
    Posts:
    127
    I want to use AssetDatabase.CopyAsset to copy my asset. I want to Identify it's sub asset when copy over.
    First time I use sub asset name to identify same sub asset in Main Asset.but when we have same sub asset name. I can't identify sub asset just use name.

    I wonder if the sub asset's relative instanceid is always same relative to Main Asset?

    MyAsset : 1000
    sub01: 1001
    sub02: 1002
    sub02: 1003

    Copy-MyAsset:2000
    sub01:2001
    sub02:2002
    sub02:2003

    If the sub asset instance id is same relative to main asset I can identify sub02(1003) in MyAsset and sub02(2003) will be the "same" sub asset when make a copy.

    thanks.