示例#1
0
        public static void CopyPluginsAndGizmosToAssetsFolder()
        {
            char   s          = Path.DirectorySeparatorChar;
            String assetsPath = Environment.CurrentDirectory + s + "Assets";
            // 1. The gizmos
            String gizmosPath = assetsPath + s + "Gizmos";

            DirectoryCopy.Copy(assetsPath + s + "Simul" + s + "Gizmos", gizmosPath, true, true, true, false, true);
            // 2. The plugins folder
            String pluginsPath = assetsPath + s + "Plugins";

            DirectoryCopy.Copy(assetsPath + s + "Simul" + s + "Plugins", pluginsPath, true, true, true, false, true);
        }
示例#2
0
        public void OnPreprocessBuild(BuildTarget target, string pathToBuiltProject)
        {
            char s = Path.DirectorySeparatorChar;

            //string buildDirectory = pathToBuiltProject.Replace(".exe", "_Data");
            // If building for ps4 also copy to StreamingAssets folder
            if (target == BuildTarget.PS4)
            {
                string shaderbinSource = trueSKY.GetShaderbinSourceDir("ps4");
                string assetsPath      = Environment.CurrentDirectory + s + "Assets";
                string simul           = assetsPath + s + "Simul";
                string MediaSource     = simul + s + "Media";
                string saDir           = Application.streamingAssetsPath + s + "Simul" + s + "shaderbin" + s + "ps4";
                DirectoryCopy.Copy(shaderbinSource, saDir, true, true, false, false);
                Debug.Log("DirectoryCopy: " + shaderbinSource + "->" + saDir);
                saDir = Application.streamingAssetsPath + s + "Simul" + s + "Media";
                DirectoryCopy.Copy(MediaSource, saDir, true, true, false, false);
                Debug.Log("DirectoryCopy: " + MediaSource + "->" + saDir);
            }
            #if UNITY_GAMECORE
            if (target == BuildTarget.GameCoreScarlett)
            {
                string shaderbinSource = trueSKY.GetShaderbinSourceDir("scarlett");
                string assetsPath      = Environment.CurrentDirectory + s + "Assets";
                string simulPath       = assetsPath + s + "Simul";
                string mediaPath       = simulPath + s + "Media";

                string stagingAreaPath;
                string fixedPath = pathToBuiltProject;
                int    lastSep   = fixedPath.LastIndexOf("/");
                fixedPath       = fixedPath.Remove(lastSep);
                stagingAreaPath = fixedPath + "/Temp/StagingArea";

                DirectoryCopy.Copy(shaderbinSource, stagingAreaPath, true, true, false, false);
                Debug.Log("DirectoryCopy: " + shaderbinSource + "->" + stagingAreaPath);
                DirectoryCopy.Copy(mediaPath, stagingAreaPath, true, true, false, false);
                Debug.Log("DirectoryCopy: " + mediaPath + "->" + stagingAreaPath);
            }
            #endif
        }
示例#3
0
        public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
        {
            // Check supported targets
            if (target != BuildTarget.StandaloneWindows && target != BuildTarget.StandaloneWindows64 &&
                target != BuildTarget.PS4 && target != BuildTarget.WSAPlayer &&
            #if UNITY_GAMECORE
                target != BuildTarget.GameCoreScarlett && target != BuildTarget.GameCoreXboxOne &&
            #endif
                target != BuildTarget.Switch)
            {
                Debug.LogError("Trying to build for a non-supported platform! (" + target.ToString() + ")");
                return;
            }

            char   s = Path.DirectorySeparatorChar;
            string buildDirectory = pathToBuiltProject.Replace(".exe", "_Data");
            String targetstr      = "x86_64";
            // Per-platform changes
            if (target == BuildTarget.PS4)
            {
                buildDirectory += s + "Media" + s;
                targetstr       = "ps4";
            }
            if (target == BuildTarget.WSAPlayer)
            {
                buildDirectory += s + Application.productName + s + "Data";
            }
            if (target == BuildTarget.Switch)
            {
                targetstr = "nx";

                string fixedPath = pathToBuiltProject;
                int    lastSep   = fixedPath.LastIndexOf("/");
                fixedPath      = fixedPath.Remove(lastSep);
                buildDirectory = fixedPath + "/StagingArea/Data";
            }
            #if UNITY_GAMECORE
            if (target == BuildTarget.GameCoreScarlett)
            {
                //buildDirectory += s + "Loose" + s + "Data" + s + "Plugins";
            }
            #endif

            Debug.Log("Build directory is: " + buildDirectory);

            // Copy shaders
            string assetsPath      = Environment.CurrentDirectory + s + "Assets";
            string shaderbinSource = trueSKY.GetShaderbinSourceDir(targetstr);
            string shaderbinBuild  = buildDirectory + s + "Simul" + s + "shaderbin" + s + targetstr;
            DirectoryCopy.Copy(shaderbinSource, shaderbinBuild, true, true);
            Debug.Log("DirectoryCopy: " + shaderbinSource + "->" + shaderbinBuild);
            if (target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64)
            {
                shaderbinSource = trueSKY.GetShaderbinSourceDir("vulkan");
                shaderbinBuild  = buildDirectory + s + "Simul" + s + "shaderbin" + s + "vulkan";
                if (Directory.Exists(shaderbinSource))
                {
                    DirectoryCopy.Copy(shaderbinSource, shaderbinBuild, true, true);
                    Debug.Log("DirectoryCopy: " + shaderbinSource + "->" + shaderbinBuild);
                }
            }

            string simul = assetsPath + s + "Simul";
            // Copy media
            string MediaSource = simul + s + "Media";
            string MediaBuild  = buildDirectory + s + "Simul" + s + "Media";
            DirectoryCopy.Copy(MediaSource, MediaBuild, true, false, false, false);
            Debug.Log("DirectoryCopy: " + MediaSource + "->" + MediaBuild);
        }