GetProjectPrefabComponents() public static method

public static GetProjectPrefabComponents ( ) : UnityEngine.Component[]
return UnityEngine.Component[]
Ejemplo n.º 1
0
        /// <summary>
        /// Replaces all the references in the project (does not work with internal properties).
        /// </summary>
        /// <param name="spriteInfoList">Sprite info list.</param>
        /// <param name="spriteRenderersOnly">If set to <c>true</c> sprite renderers only.</param>
        /// <returns>The replaced references count.</returns>
        public static int ReplaceReferencesInProject(List <SPSpriteInfo> spriteInfoList, bool spriteRenderersOnly)
        {
            Component[] comps = SPTools.GetProjectPrefabComponents();

            int count = 0;

            foreach (SPSpriteInfo spriteInfo in spriteInfoList)
            {
                if (spriteInfo.source != null && spriteInfo.source is Sprite && spriteInfo.targetSprite != null)
                {
                    count += SPTools.ReplaceReferences(comps, (spriteInfo.source as Sprite), spriteInfo.targetSprite, spriteRenderersOnly);
                }
            }

            return(count);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Replaces all the references in the project (does not work with internal properties).
        /// </summary>
        /// <param name="spriteInfoList">Sprite info list.</param>
        /// <param name="spriteRenderersOnly">If set to <c>true</c> sprite renderers only.</param>
        /// <returns>The replaced references count.</returns>
        public static int ReplaceReferencesInProject(List <SPSpriteInfo> spriteInfoList, SPReferenceReplacerWindow.ReplaceMode replaceMode, bool spriteRenderersOnly)
        {
            Component[] comps = SPTools.GetProjectPrefabComponents();

            bool replaceAtlas = (replaceMode == SPReferenceReplacerWindow.ReplaceMode.AtlasWithSource);

            int count = 0;

            foreach (SPSpriteInfo spriteInfo in spriteInfoList)
            {
                if (spriteInfo.source == null || !(spriteInfo.source is Sprite) || spriteInfo.targetSprite == null)
                {
                    continue;
                }

                count += SPTools.ReplaceReferences(comps, (replaceAtlas ? spriteInfo.targetSprite : (spriteInfo.source as Sprite)), (replaceAtlas ? (spriteInfo.source as Sprite) : spriteInfo.targetSprite), spriteRenderersOnly);
            }

            return(count);
        }