public void WhenLocatorWithAssetsInMarkedFolder_LocateWithAssetReferenceSucceeds()
 {
     CreateFolder("TestFolder1/TestFolder2", new string[] { "asset1.asset", "asset2.asset", "asset3.asset" });
     var folderGUID = AssetDatabase.AssetPathToGUID(GetPath("TestFolder1"));
     m_Settings.CreateOrMoveEntry(folderGUID, m_Settings.DefaultGroup).address = "TF1";
     var assetRef = m_Settings.CreateAssetReference(AssetDatabase.AssetPathToGUID(GetPath("TestFolder1/TestFolder2/asset1.asset")));
     AssertLocateResult(new AddressableAssetSettingsLocator(m_Settings), assetRef.RuntimeKey, null, GetPath("TestFolder1/TestFolder2/asset1.asset"));
 }
Ejemplo n.º 2
0
        internal override void Setup(AddressableAssetSettings settings, string tempAssetFolder)
        {
            AddressableAssetGroup assetReference = settings.CreateGroup("assetReferenceSamplesGroup", false, false, true,
                                                                        new List <AddressableAssetGroupSchema>(), typeof(BundledAssetGroupSchema));

            GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
            AssetReferenceTestBehavior behavior = go.AddComponent <AssetReferenceTestBehavior>();

            string hasBehaviorPath = tempAssetFolder + "/AssetReferenceBehavior.prefab";

            string referencePath = tempAssetFolder + "/reference.prefab";
            string guid          = CreatePrefab(referencePath);

            behavior.Reference             = settings.CreateAssetReference(guid);
            behavior.AssetReferenceAddress = referencePath.Replace("\\", "/");

            PrefabUtility.SaveAsPrefabAsset(go, hasBehaviorPath);
            settings.CreateOrMoveEntry(AssetDatabase.AssetPathToGUID(hasBehaviorPath), assetReference, false, false).address = m_AssetReferenceObjectKey;
        }