GetBuildTargetGroup() private method

private GetBuildTargetGroup ( BuildTarget platform ) : BuildTargetGroup
platform BuildTarget
return BuildTargetGroup
        public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            BuildTargetGroup targetPlatformGroup = BuildPipeline.GetBuildTargetGroup(targetPlatform);

            return(BuildAssetBundleExplicitAssetNames(assets, assetNames, pathName, out crc, assetBundleOptions, targetPlatformGroup, targetPlatform));
        }
        static void RefreshGameViewSizeGroupType(BuildTarget oldTarget, BuildTarget newTarget)
        {
            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(newTarget);

            s_GameViewSizeGroupType = BuildTargetGroupToGameViewSizeGroup(buildTargetGroup);
        }
        public static string BuildStreamedSceneAssetBundle(string[] levels, string locationPath, BuildTarget target, out uint crc, BuildOptions options)
        {
            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(target);

            return(BuildStreamedSceneAssetBundle(levels, locationPath, buildTargetGroup, target, out crc, options));
        }
示例#4
0
        protected void InitRuntimeClassRegistry()
        {
            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this.buildTarget);

            this.AddFunctionalityGroup("Runtime", "[no manager]");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "GameObject");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "Material");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "PreloadData");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "PlayerSettings");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "InputManager");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "BuildSettings");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "GraphicsSettings");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "QualitySettings");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "MonoManager");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "AudioManager");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "ScriptMapper");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "DelayedCallManager");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "TimeManager");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "Cubemap");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "Texture3D");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "LODGroup");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GameObject), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Transform), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Mesh), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SkinnedMeshRenderer), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(MeshRenderer), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(UnityException), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Resolution));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(LayerMask));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SerializeField));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(WaitForSeconds));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(WaitForFixedUpdate));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(WaitForEndOfFrame));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AssetBundle), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AssetBundleRequest));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Event), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(HideInInspector));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SerializePrivateVariables));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SerializeField));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Font), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUIStyle));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUISkin), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUITargetAttribute), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUI), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(TextGenerator), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SendMouseEvents), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SetupCoroutine), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Coroutine));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AttributeHelperEngine), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(StackTraceUtility), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUIUtility), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUI), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Application), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Animation), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AnimationClip), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AnimationEvent));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AsyncOperation));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Resources), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(CacheIndex));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Keyframe));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(RenderTexture));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AnimationCurve), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(BoneWeight));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Particle));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SliderState), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUI.ScrollViewState), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GUIScrollGroup), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(TextEditor), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(ClassLibraryInitializer), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AssetBundleCreateRequest), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "ImageEffectTransformsToLDR");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "ImageEffectOpaque");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Gradient), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GradientColorKey));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(GradientAlphaKey));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Canvas), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(RectTransform), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AssemblyIsEditorAssembly), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Camera), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(CullingGroup), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(StateMachineBehaviour), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "Experimental.Networking.DownloadHandler", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "Experimental.Director.Playable", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SharedBetweenAnimatorsAttribute), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AnimatorStateInfo), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AnimatorTransitionInfo), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AnimatorClipInfo), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(SkeletonBone), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(HumanBone), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(UIVertex), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(UICharInfo), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(UILineInfo), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AudioClip), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AudioMixer), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(AudioSettings), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "iPhone", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJNI", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJNIHelper", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "_AndroidJNIHelper", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJavaObject", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJavaClass", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJavaRunnableProxy", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "SamsungTV", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(ISerializationCallbackReceiver), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "UnhandledExceptionHandler", "all");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", "Display", "all");
            switch (buildTargetGroup)
            {
            case BuildTargetGroup.Android:
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJNI", "all");
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJNIHelper", "all");
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "_AndroidJNIHelper", "all");
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJavaObject", "all");
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJavaClass", "all");
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "AndroidJavaRunnableProxy", "all");
                break;

            case BuildTargetGroup.SamsungTV:
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "SamsungTV", "all");
                break;

            case BuildTargetGroup.iPhone:
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "iPhoneKeyboard");
                break;
            }
            if ((buildTargetGroup == BuildTargetGroup.iPhone) || ((buildTargetGroup == BuildTargetGroup.Standalone) && (((this.buildTarget == BuildTarget.StandaloneOSXIntel) || (this.buildTarget == BuildTarget.StandaloneOSXIntel64)) || (this.buildTarget == BuildTarget.StandaloneOSXUniversal))))
            {
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "SocialPlatforms.GameCenter.GameCenterPlatform", "all");
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "SocialPlatforms.GameCenter.GcLeaderboard", "all");
            }
            if ((((buildTargetGroup == BuildTargetGroup.iPhone) || (buildTargetGroup == BuildTargetGroup.Android)) || ((buildTargetGroup == BuildTargetGroup.BlackBerry) || (buildTargetGroup == BuildTargetGroup.WP8))) || ((buildTargetGroup == BuildTargetGroup.Metro) || (buildTargetGroup == BuildTargetGroup.Tizen)))
            {
                this.AddManagedDependenciesForFunctionalityGroup("Runtime", "TouchScreenKeyboard");
            }
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "NetworkManager");
            this.AddNativeDependenciesForFunctionalityGroup("Runtime", "NetworkView");
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Network));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(NetworkMessageInfo));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(RPC));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(HostData));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(BitStream));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(NetworkPlayer));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(NetworkViewID));
            this.AddManagedDependenciesForFunctionalityGroup("Runtime", typeof(Ping), "all");
            this.AddFunctionalityGroup("Physics", "PhysicsManager");
            this.AddNativeDependenciesForFunctionalityGroup("Physics", "PhysicsManager");
            this.AddNativeDependenciesForFunctionalityGroup("Physics", "Rigidbody");
            this.AddNativeDependenciesForFunctionalityGroup("Physics", "Collider");
            this.AddManagedDependenciesForFunctionalityGroup("Physics", typeof(ControllerColliderHit));
            this.AddManagedDependenciesForFunctionalityGroup("Physics", typeof(RaycastHit));
            this.AddManagedDependenciesForFunctionalityGroup("Physics", typeof(Collision));
            this.AddManagedDependenciesForFunctionalityGroup("Physics", typeof(MeshCollider));
            this.AddFunctionalityGroup("Physics2D", "Physics2DSettings");
            this.AddNativeDependenciesForFunctionalityGroup("Physics2D", "Physics2DSettings");
            this.AddNativeDependenciesForFunctionalityGroup("Physics2D", "Rigidbody2D");
            this.AddNativeDependenciesForFunctionalityGroup("Physics2D", "Collider2D");
            this.AddNativeDependenciesForFunctionalityGroup("Physics2D", "Joint2D");
            this.AddNativeDependenciesForFunctionalityGroup("Physics2D", "PhysicsMaterial2D");
            this.AddManagedDependenciesForFunctionalityGroup("Physics2D", typeof(RaycastHit2D));
            this.AddManagedDependenciesForFunctionalityGroup("Physics2D", typeof(Collision2D));
            this.AddManagedDependenciesForFunctionalityGroup("Physics2D", typeof(JointMotor2D));
            this.AddManagedDependenciesForFunctionalityGroup("Physics2D", typeof(JointAngleLimits2D));
            this.AddManagedDependenciesForFunctionalityGroup("Physics2D", typeof(JointTranslationLimits2D));
            this.AddManagedDependenciesForFunctionalityGroup("Physics2D", typeof(JointSuspension2D));
            this.AddFunctionalityGroup("UnityAds", "UnityAdsSettings");
            this.AddNativeDependenciesForFunctionalityGroup("UnityAds", "UnityAdsSettings");
            this.AddManagedDependenciesForFunctionalityGroup("UnityAds", typeof(UnityAdsManager), "all");
            this.AddFunctionalityGroup("Terrain", "Terrain");
            this.AddManagedDependenciesForFunctionalityGroup("Terrain", typeof(Terrain), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Terrain", typeof(TerrainData), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Terrain", typeof(TerrainCollider), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Terrain", typeof(DetailPrototype), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Terrain", typeof(TreePrototype), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Terrain", typeof(TreeInstance), "all");
            this.AddManagedDependenciesForFunctionalityGroup("Terrain", typeof(SplatPrototype), "all");
            this.AddFunctionalityGroup("Shuriken", "ParticleSystem");
            this.AddManagedDependenciesForFunctionalityGroup("Shuriken", typeof(ParticleSystem));
            this.AddManagedDependenciesForFunctionalityGroup("Shuriken", typeof(ParticleSystemRenderer));
            this.AddManagedBaseClass("UnityEngine.MonoBehaviour");
            this.AddManagedBaseClass("UnityEngine.ScriptableObject");
            if (buildTargetGroup == BuildTargetGroup.Android)
            {
                this.AddManagedBaseClass("UnityEngine.AndroidJavaProxy");
            }
            foreach (string str in RuntimeInitializeOnLoadManager.dontStripClassNames)
            {
                this.AddManagedBaseClass(str);
            }
        }
示例#5
0
 public static bool SwitchActiveBuildTarget(BuildTarget target)
 {
     return(SwitchActiveBuildTarget(BuildPipeline.GetBuildTargetGroup(target), target));
 }
        // This function is responsible for providing all the subscenes to the build.
        //
        // The way these files get generated is that we have a SceneWithBuildConfiguration file, (which is a bit of a hack to work around the inability for scriptable importers to take arguments, so
        // instead we create a different file that points to the scene we want to import, and points to the buildconfiguration we want to import it for).   The SubsceneImporter will import this file,
        // and it will make 3 (relevant) kind of files:
        // - headerfile
        // - entitybinaryformat file (the actual entities payloads)
        // - a SerializedFile that has an array of UnityEngine.Object PPtrs that are used by this entity file.
        //
        // The first two we deal with very simply: they just need to be copied into the build, and we're done.
        // the third one, we will feed as input to the Scriptable build pipeline (which is actually about creating assetbundles), and create an assetbundle that
        // has all those objects in it that the 3rd file referred to.  We do this with a batch api, first we loop through all subscenes, and register with this batch
        // api which assetbundles we'd like to see produced, and then at the end, we say "okay make them please".  this assetbundle creation api has a caching system
        // that is separate from the assetpipeline caching system, so if all goes well, the call to produce these assetbundles will return very fast and did nothing.
        //
        // The reason for the strange looking api, where a two callbacks get passed in is to make integration of the new incremental buildpipeline easier, as this code
        // needs to be compatible both with the current buildpipeline in the dots-repo, as well as with the incremental buildpipeline.  When that is merged, we can simplify this.
        public static void PrepareAdditionalFiles(GUID[] sceneGuids, ArtifactKey[] entitySceneArtifacts, BuildTarget target, Action <string, string> RegisterFileCopy, string outputStreamingAssetsDirectory, string buildWorkingDirectory)
        {
            if (target == BuildTarget.NoTarget)
            {
                throw new InvalidOperationException($"Invalid build target '{target.ToString()}'.");
            }

            if (target != EditorUserBuildSettings.activeBuildTarget)
            {
                throw new InvalidOperationException($"ActiveBuildTarget must be switched before the {nameof(SubSceneBuildCode)} runs.");
            }

            Assert.AreEqual(sceneGuids.Length, entitySceneArtifacts.Length);

            var content             = new BundleBuildContent(new AssetBundleBuild[0]);
            var bundleNames         = new HashSet <string>();
            var subScenePaths       = new Dictionary <Hash128, string>();
            var dependencyInputData = new Dictionary <SceneSection, SectionDependencyInfo>();

            var    refExt    = EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesUnityObjectReferences);
            var    headerExt = EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesHeader);
            var    binaryExt = EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesBinary);
            string conversionLogExtension = EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesConversionLog);

            var group      = BuildPipeline.GetBuildTargetGroup(target);
            var parameters = new BundleBuildParameters(target, @group, buildWorkingDirectory)
            {
                BundleCompression = BuildCompression.LZ4Runtime
            };

            var artifactHashes = new UnityEngine.Hash128[entitySceneArtifacts.Length];

            AssetDatabaseCompatibility.ProduceArtifactsRefreshIfNecessary(entitySceneArtifacts, artifactHashes);

            for (int i = 0; i != entitySceneArtifacts.Length; i++)
            {
                var sceneGuid            = sceneGuids[i];
                var sceneBuildConfigGuid = entitySceneArtifacts[i].guid;
                var artifactHash         = artifactHashes[i];

                bool foundEntityHeader = false;

                if (!artifactHash.isValid)
                {
                    throw new Exception($"Building EntityScene artifact failed: '{AssetDatabaseCompatibility.GuidToPath(sceneGuid)}' ({sceneGuid}). There were exceptions during the entity scene imports.");
                }

                AssetDatabaseCompatibility.GetArtifactPaths(artifactHash, out var artifactPaths);

                foreach (var artifactPath in artifactPaths)
                {
                    //UnityEngine.Debug.Log($"guid: {sceneGuid} artifact: '{artifactPath}'");

                    //@TODO: This looks like a workaround. Whats going on here?
                    var ext = Path.GetExtension(artifactPath).Replace(".", "");

                    if (ext == conversionLogExtension)
                    {
                        var res = ConversionLogUtils.PrintConversionLogToUnityConsole(artifactPath);

                        if (res.HasException)
                        {
                            throw new Exception("Building entity scenes failed. There were exceptions during the entity scene imports.");
                        }
                    }
                    else if (ext == headerExt)
                    {
                        foundEntityHeader = true;

                        if (!string.IsNullOrEmpty(artifactPaths.FirstOrDefault(a => a.EndsWith(refExt))))
                        {
                            subScenePaths[sceneGuid] = artifactPath;
                        }
                        else
                        {
                            //if there are no reference bundles, then deduplication can be skipped
                            var destinationFile = EntityScenesPaths.RelativePathFolderFor(sceneGuid, EntityScenesPaths.PathType.EntitiesHeader, -1);
                            DoCopy(RegisterFileCopy, outputStreamingAssetsDirectory, artifactPath, destinationFile);
                        }
                    }
                    else if (ext == binaryExt)
                    {
                        var destinationFile = EntityScenesPaths.RelativePathFolderFor(sceneGuid, EntityScenesPaths.PathType.EntitiesBinary, EntityScenesPaths.GetSectionIndexFromPath(artifactPath));
                        DoCopy(RegisterFileCopy, outputStreamingAssetsDirectory, artifactPath, destinationFile);
                    }
                    else if (ext == refExt)
                    {
                        content.CustomAssets.Add(new CustomContent
                        {
                            Asset     = sceneBuildConfigGuid,
                            Processor = (guid, processor) =>
                            {
                                var sectionIndex = EntityScenesPaths.GetSectionIndexFromPath(artifactPath);
                                processor.GetObjectIdentifiersAndTypesForSerializedFile(artifactPath, out ObjectIdentifier[] objectIds, out Type[] types);
示例#7
0
        private static void RefreshGameViewSizeGroupType()
        {
            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);

            GameViewSizes.s_GameViewSizeGroupType = GameViewSizes.BuildTargetGroupToGameViewSizeGroup(buildTargetGroup);
        }
示例#8
0
 internal static string GetBuildTargetGroupName(BuildTarget target)
 {
     return(BuildPipeline.GetBuildTargetGroupName(BuildPipeline.GetBuildTargetGroup(target)));
 }
        public override void OnPreviewGUI(Rect r, GUIStyle background)
        {
            VideoClipImporter importer = (VideoClipImporter)target;

            if (m_IsPlaying && !importer.isPlayingPreview)
            {
                importer.PlayPreview();
            }
            else if (!m_IsPlaying && importer.isPlayingPreview)
            {
                importer.StopPreview();
            }

            Texture image = importer.GetPreviewTexture();

            if (image && image.width != 0 && image.height != 0)
            {
                m_Texture = image;
            }

            if (!m_Texture)
            {
                return;
            }

            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(r, false, false, false, false);
            }

            // Compensate spatial quality zooming, if any.
            float previewWidth   = m_Texture.width;
            float previewHeight  = m_Texture.height;
            var   activeSettings =
                importer.GetTargetSettings(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget).ToString());

            if (activeSettings == null)
            {
                activeSettings = importer.defaultTargetSettings;
            }
            if (activeSettings.enableTranscoding)
            {
                VideoResizeMode resizeMode = activeSettings.resizeMode;
                previewWidth  = importer.GetResizeWidth(resizeMode);
                previewHeight = importer.GetResizeHeight(resizeMode);
            }

            if (importer.pixelAspectRatioDenominator > 0)
            {
                previewWidth *= (float)importer.pixelAspectRatioNumerator /
                                (float)importer.pixelAspectRatioDenominator;
            }

            float zoomLevel = 1.0f;

            if ((r.width / previewWidth * previewHeight) > r.height)
            {
                zoomLevel = r.height / previewHeight;
            }
            else
            {
                zoomLevel = r.width / previewWidth;
            }

            zoomLevel = Mathf.Clamp01(zoomLevel);

            Rect wantedRect = new Rect(r.x, r.y, previewWidth * zoomLevel, previewHeight * zoomLevel);

            PreviewGUI.BeginScrollView(
                r, m_Position, wantedRect, "PreHorizontalScrollbar", "PreHorizontalScrollbarThumb");

            EditorGUI.DrawTextureTransparent(wantedRect, m_Texture, ScaleMode.StretchToFill);

            m_Position = PreviewGUI.EndScrollView();

            if (m_IsPlaying && Event.current.type == EventType.Repaint)
            {
                GUIView.current.Repaint();
            }
        }
示例#10
0
        public static bool BuildAssetBundle(UnityEngine.Object mainAsset, UnityEngine.Object[] assets, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(targetPlatform);

            return(BuildPipeline.BuildAssetBundle(mainAsset, assets, pathName, out crc, assetBundleOptions, buildTargetGroup, targetPlatform));
        }
示例#11
0
        internal static string GetPlaybackEngineDirectory(BuildTarget target, BuildOptions options)
        {
            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(target);

            return(BuildPipeline.GetPlaybackEngineDirectory(buildTargetGroup, target, options));
        }
示例#12
0
        public override void OnInspectorGUI()
        {
            settings.Update();

            var c = (Camera)target;

            m_ShowBGColorOptions.target = !clearFlagsHasMultipleValues && (c.clearFlags == CameraClearFlags.SolidColor || c.clearFlags == CameraClearFlags.Skybox);
            m_ShowOrthoOptions.target   = !orthographicHasMultipleValues && c.orthographic;

            bool displaySubsystemPresent = displayDescriptors.Count > 0;

            m_ShowTargetEyeOption.target = targetEyeValue != (int)StereoTargetEyeMask.Both || VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)) || displaySubsystemPresent;

            settings.DrawClearFlags();

            if (EditorGUILayout.BeginFadeGroup(m_ShowBGColorOptions.faded))
            {
                settings.DrawBackgroundColor();
            }
            EditorGUILayout.EndFadeGroup();

            settings.DrawCullingMask();

            EditorGUILayout.Space();

            settings.DrawProjection();

            if (displaySubsystemPresent && targetEyeValue != (int)StereoTargetEyeMask.None && c.orthographic && c.targetTexture == null)
            {
                GUILayout.Label(EditorGUIUtility.TrTextContent("Orthographic projection is not supported when running in XR.", "One or more XR Plug-in providers were detected in your project. Using Orthographic projection is not supported when running in XR and enabling this may cause problems.", EditorGUIUtility.warningIcon));
            }

            settings.DrawClippingPlanes();

            settings.DrawNormalizedViewPort();

            EditorGUILayout.Space();
            settings.DrawDepth();
            settings.DrawRenderingPath();
            if (m_ShowOrthoOptions.target && wantDeferredRendering)
            {
                EditorGUILayout.HelpBox("Deferred rendering does not work with Orthographic camera, will use Forward.",
                                        MessageType.Warning, true);
            }

            settings.DrawTargetTexture(wantDeferredRendering);
            settings.DrawOcclusionCulling();
            settings.DrawHDR();
            settings.DrawMSAA();
            settings.DrawDynamicResolution();

            foreach (Camera camera in targets)
            {
                if (camera != null)
                {
                    Settings.DrawCameraWarnings(camera);
                }
            }

            settings.DrawVR();
            EditorGUILayout.Space();
            settings.DrawMultiDisplay();

            if (EditorGUILayout.BeginFadeGroup(m_ShowTargetEyeOption.faded))
            {
                settings.DrawTargetEye();
            }
            EditorGUILayout.EndFadeGroup();

            DepthTextureModeGUI();
            CommandBufferGUI();

            serializedObject.ApplyModifiedProperties();
        }
示例#13
0
        public void OnEnable()
        {
            settings.OnEnable();

            var c = (Camera)target;

            m_ShowBGColorOptions.value  = !clearFlagsHasMultipleValues && (c.clearFlags == CameraClearFlags.SolidColor || c.clearFlags == CameraClearFlags.Skybox);
            m_ShowOrthoOptions.value    = c.orthographic;
            m_ShowTargetEyeOption.value = targetEyeValue != (int)StereoTargetEyeMask.Both || VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget));

            m_ShowBGColorOptions.valueChanged.AddListener(Repaint);
            m_ShowOrthoOptions.valueChanged.AddListener(Repaint);
            m_ShowTargetEyeOption.valueChanged.AddListener(Repaint);

            SubsystemManager.GetSubsystemDescriptors(displayDescriptors);
            SubsystemManager.afterReloadSubsystems += OnReloadSubsystemsComplete;
        }
 public static bool SwitchActiveBuildTarget(BuildTarget target)
 {
     return(EditorUserBuildSettings.SwitchActiveBuildTarget(BuildPipeline.GetBuildTargetGroup(target), target));
 }
        public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            BuildTargetGroup targetPlatformGroup = BuildPipeline.GetBuildTargetGroup(targetPlatform);

            return(BuildAssetBundles(outputPath, builds, assetBundleOptions, targetPlatformGroup, targetPlatform));
        }
 public static void SetPropertyBool(string name, bool value, BuildTarget target)
 {
     SetPropertyBool(name, value, BuildPipeline.GetBuildTargetGroup(target));
 }
示例#17
0
 private bool ShouldShowTargetDisplayProperty()
 {
     GUIContent[] displayNames = ModuleManager.GetDisplayNames(EditorUserBuildSettings.activeBuildTarget.ToString());
     return(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget) == BuildTargetGroup.Standalone || displayNames != null);
 }
 public static void SetPropertyString(string name, string value, BuildTarget target)
 {
     SetPropertyString(name, value, BuildPipeline.GetBuildTargetGroup(target));
 }
示例#19
0
        // This function is responsible for providing all the subscenes to the build.
        //
        // The way these files get generated is that we have a SceneWithBuildConfiguration file, (which is a bit of a hack to work around the inability for scriptable importers to take arguments, so
        // instead we create a different file that points to the scene we want to import, and points to the buildconfiguration we want to import it for).   The SubsceneImporter will import this file,
        // and it will make 3 (relevant) kind of files:
        // - headerfile
        // - entitybinaryformat file (the actual entities payloads)
        // - a SerializedFile that has an array of UnityEngine.Object PPtrs that are used by this entity file.
        //
        // The first two we deal with very simply: they just need to be copied into the build, and we're done.
        // the third one, we will feed as input to the Scriptable build pipeline (which is actually about creating assetbundles), and create an assetbundle that
        // has all those objects in it that the 3rd file referred to.  We do this with a batch api, first we loop through all subscenes, and register with this batch
        // api which assetbundles we'd like to see produced, and then at the end, we say "okay make them please".  this assetbundle creation api has a caching system
        // that is separate from the assetpipeline caching system, so if all goes well, the call to produce these assetbundles will return very fast and did nothing.
        //
        // The reason for the strange looking api, where a two callbacks get passed in is to make integration of the new incremental buildpipeline easier, as this code
        // needs to be compatible both with the current buildpipeline in the dots-repo, as well as with the incremental buildpipeline.  When that is merged, we can simplify this.
        public static void PrepareAdditionalFiles(string buildConfigurationGuid, string[] scenePathsForBuild, BuildTarget target, Action <string, string> RegisterFileCopy, string outputStreamingAssetsDirectory, string buildWorkingDirectory)
        {
            if (target == BuildTarget.NoTarget)
            {
                throw new InvalidOperationException($"Invalid build target '{target.ToString()}'.");
            }

            if (target != EditorUserBuildSettings.activeBuildTarget)
            {
                throw new InvalidOperationException($"ActiveBuildTarget must be switched before the {nameof(SubSceneBuildCode)} runs.");
            }

            var content             = new BundleBuildContent(new AssetBundleBuild[0]);
            var bundleNames         = new HashSet <string>();
            var subSceneGuids       = scenePathsForBuild.SelectMany(scenePath => SceneMetaDataImporter.GetSubSceneGuids(AssetDatabase.AssetPathToGUID(scenePath))).Distinct().ToList();
            var subScenePaths       = new Dictionary <Hash128, string>();
            var dependencyInputData = new Dictionary <SceneSection, SectionDependencyInfo>();
            var refExt    = EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesUnityObjectReferences);
            var headerExt = EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesHeader);
            var binaryExt = EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesBinary);

            var group      = BuildPipeline.GetBuildTargetGroup(target);
            var parameters = new BundleBuildParameters(target, @group, buildWorkingDirectory)
            {
                BundleCompression = BuildCompression.LZ4Runtime
            };

            var requiresRefresh       = false;
            var sceneBuildConfigGuids = new NativeArray <GUID>(subSceneGuids.Count, Allocator.TempJob);

            for (int i = 0; i != sceneBuildConfigGuids.Length; i++)
            {
                sceneBuildConfigGuids[i] = SceneWithBuildConfigurationGUIDs.EnsureExistsFor(subSceneGuids[i], new Hash128(buildConfigurationGuid), out var thisRequiresRefresh);
                requiresRefresh         |= thisRequiresRefresh;
            }
            if (requiresRefresh)
            {
                AssetDatabase.Refresh();
            }

            var artifactHashes = new NativeArray <UnityEngine.Hash128>(subSceneGuids.Count, Allocator.TempJob);

            AssetDatabaseCompatibility.ProduceArtifactsRefreshIfNecessary(sceneBuildConfigGuids, typeof(SubSceneImporter), artifactHashes);

            for (int i = 0; i != sceneBuildConfigGuids.Length; i++)
            {
                var sceneGuid            = subSceneGuids[i];
                var sceneBuildConfigGuid = sceneBuildConfigGuids[i];
                var artifactHash         = artifactHashes[i];

                bool foundEntityHeader = false;
                AssetDatabaseCompatibility.GetArtifactPaths(artifactHash, out var artifactPaths);
                foreach (var artifactPath in artifactPaths)
                {
                    //@TODO: This looks like a workaround. Whats going on here?
                    var ext = Path.GetExtension(artifactPath).Replace(".", "");
                    if (ext == headerExt)
                    {
                        foundEntityHeader = true;

                        if (!string.IsNullOrEmpty(artifactPaths.FirstOrDefault(a => a.EndsWith(refExt))))
                        {
                            subScenePaths[sceneGuid] = artifactPath;
                        }
                        else
                        {
                            //if there are no reference bundles, then deduplication can be skipped
                            var destinationFile = EntityScenesPaths.RelativePathFolderFor(sceneGuid, EntityScenesPaths.PathType.EntitiesHeader, -1);
                            DoCopy(RegisterFileCopy, outputStreamingAssetsDirectory, artifactPath, destinationFile);
                        }
                    }
                    else if (ext == binaryExt)
                    {
                        var destinationFile = EntityScenesPaths.RelativePathFolderFor(sceneGuid, EntityScenesPaths.PathType.EntitiesBinary, EntityScenesPaths.GetSectionIndexFromPath(artifactPath));
                        DoCopy(RegisterFileCopy, outputStreamingAssetsDirectory, artifactPath, destinationFile);
                    }

                    if (ext == refExt)
                    {
                        content.CustomAssets.Add(new CustomContent
                        {
                            Asset     = sceneBuildConfigGuid,
                            Processor = (guid, processor) =>
                            {
                                var sectionIndex = EntityScenesPaths.GetSectionIndexFromPath(artifactPath);
                                processor.GetObjectIdentifiersAndTypesForSerializedFile(artifactPath, out ObjectIdentifier[] objectIds, out Type[] types);
示例#20
0
        private void AllRootCanvases()
        {
            if (VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)) && (m_RenderMode.enumValueIndex == (int)RenderMode.ScreenSpaceOverlay))
            {
                EditorGUILayout.HelpBox("Using a render mode of ScreenSpaceOverlay while VR is enabled will cause the Canvas to continue to incur a rendering cost, even though the Canvas will not be visible in VR.", MessageType.Warning);
            }

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(m_RenderMode);
            if (EditorGUI.EndChangeCheck())
            {
                var rectTransforms = targets.Select(c => (c as Canvas).transform).ToArray();
                Undo.RegisterCompleteObjectUndo(rectTransforms, "Modified RectTransform Values");
                serializedObject.ApplyModifiedProperties();
                foreach (Canvas canvas in targets)
                {
                    canvas.UpdateCanvasRectTransform(true);
                }
                GUIUtility.ExitGUI();
            }

            m_OverlayMode.target = m_RenderMode.intValue == 0;
            m_CameraMode.target  = m_RenderMode.intValue == 1;
            m_WorldMode.target   = m_RenderMode.intValue == 2;

            EditorGUI.indentLevel++;
            if (EditorGUILayout.BeginFadeGroup(m_OverlayMode.faded))
            {
                DoPixelPerfectGUIForRoot();

                EditorGUILayout.PropertyField(m_SortingOrder, Styles.sortingOrder);
                GUIContent[] displayNames = DisplayUtility.GetDisplayNames();
                EditorGUILayout.IntPopup(m_TargetDisplay, displayNames, DisplayUtility.GetDisplayIndices(), Styles.targetDisplay);
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_CameraMode.faded))
            {
                DoPixelPerfectGUIForRoot();

                EditorGUILayout.PropertyField(m_Camera, Styles.renderCamera);

                if (m_Camera.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("A Screen Space Canvas with no specified camera acts like an Overlay Canvas.",
                                            MessageType.Warning);
                }

                if (m_Camera.objectReferenceValue != null)
                {
                    EditorGUILayout.PropertyField(m_PlaneDistance);
                    EditorGUILayout.PropertyField(m_UpdateRectTransformForStandalone, Styles.standaloneRenderResize);
                }

                EditorGUILayout.Space();

                if (m_Camera.objectReferenceValue != null)
                {
                    EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup, EditorStyles.label);
                }
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_WorldMode.faded))
            {
                EditorGUILayout.PropertyField(m_Camera, Styles.eventCamera);

                if (m_Camera.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("A World Space Canvas with no specified Event Camera may not register UI events correctly.",
                                            MessageType.Warning);
                }

                EditorGUILayout.Space();
                EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup);
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;
        }