コード例 #1
0
ファイル: AssetNotification.cs プロジェクト: AiramNavas/pipo
        private static void UpdateReimportExistAssets(string assetPath)
        {
            Utility.DebugLog(string.Format("Update: {0}", assetPath));

            var guid = AssetDatabase.AssetPathToGUID(assetPath);

            UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object));

            if (obj is MovieTexture)
            {
                webCommunicationService.UpdateObjectsIntoCache(APAssetType.MovieTexture, guid, SyncManager.ModifiedAssets);
            }
            else if (obj is Texture)
            {
                webCommunicationService.UpdateObjectsIntoCache(APAssetType.Texture, guid, SyncManager.ModifiedAssets);
            }

            APResources.UnloadAsset(obj);
        }
コード例 #2
0
        private UnityEngine.Object GetAnimationObjectFromModel(string assetid)
        {
            string guid   = Utility.GetGuidFromAssetId(assetid);
            string fileId = Utility.GetFileIdFromAssetId(assetid);

            Utility.DebugLog(string.Format("Find Animation in {0} with id {1}", guid, fileId));

            if (string.IsNullOrEmpty(guid) || string.IsNullOrEmpty(fileId))
            {
                return(null);
            }

            var objects = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GUIDToAssetPath(guid));

            Utility.DebugLog(string.Format("Get {0} items in {1}", objects.Length, assetid));

            foreach (var obj in objects)
            {
                if (obj is AnimationClip && Utility.GetLocalIndentifierOfObject(obj).ToString() == fileId)
                {
                    // Release loaded objects
                    //
                    foreach (var item in objects)
                    {
                        if (obj != item)
                        {
                            APResources.UnloadAsset(item);
                        }
                    }

                    return(obj);
                }
            }

            foreach (var item in objects)
            {
                APResources.UnloadAsset(item);
            }

            return(null);
        }