@@ -2008,7 +2008,21 @@ public static void LaunchWebGL(Project proj, string relativeFolder)
2008
2008
// take process id from unity, if have it (then webserver closes automatically when unity is closed)
2009
2009
var proc = ProcessHandler . Get ( proj . Path ) ;
2010
2010
int pid = proc == null ? - 1 : proc . Id ;
2011
- var param = "\" " + webExe + "\" \" " + buildPath + "\" " + port + ( pid == - 1 ? "" : " " + pid ) ; // server exe path, build folder and port
2011
+ string param = null ;
2012
+
2013
+ // parse proj version year as number 2019.4.1f1 -> 2019
2014
+ int year = 0 ;
2015
+ var versionParts = proj . Version . Split ( '.' ) ;
2016
+ bool parsedYear = int . TryParse ( versionParts [ 0 ] , out year ) ;
2017
+
2018
+ if ( parsedYear && year >= 6000 )
2019
+ {
2020
+ param = "\" " + webExe + "\" \" " + buildPath + "\" " + "http://localhost:" + port + "/" + ( pid == - 1 ? "" : " " + pid ) ;
2021
+ }
2022
+ else // older versions or failed to parse
2023
+ {
2024
+ param = "\" " + webExe + "\" \" " + buildPath + "\" " + port + ( pid == - 1 ? "" : " " + pid ) ; // server exe path, build folder and port
2025
+ }
2012
2026
2013
2027
var webglServerProcess = Tools . LaunchExe ( monoExe , param ) ;
2014
2028
@@ -2068,7 +2082,23 @@ public static void LaunchWebGL(Project proj, string relativeFolder)
2068
2082
// take process id from unity, if have it(then webserver closes automatically when unity is closed)
2069
2083
var proc = ProcessHandler . Get ( proj . Path ) ;
2070
2084
int pid = proc == null ? - 1 : proc . Id ;
2071
- var param = "\" " + webExe + "\" \" " + buildPath + "\" " + port + ( pid == - 1 ? "" : " " + pid ) ; // server exe path, build folder and port
2085
+
2086
+ // parse proj version year as number 2019.4.1f1 -> 2019
2087
+ string param = null ;
2088
+ int year = 0 ;
2089
+ var versionParts = proj . Version . Split ( '.' ) ;
2090
+ bool parsedYear = int . TryParse ( versionParts [ 0 ] , out year ) ;
2091
+
2092
+ if ( parsedYear && year >= 6000 )
2093
+ {
2094
+ param = "\" " + webExe + "\" \" " + buildPath + "\" " + "\" http://localhost:" + port + "/\" " + ( pid == - 1 ? "" : " " + pid ) ;
2095
+ }
2096
+ else // older versions or failed to parse
2097
+ {
2098
+ param = "\" " + webExe + "\" \" " + buildPath + "\" " + port + ( pid == - 1 ? "" : " " + pid ) ; // server exe path, build folder and port
2099
+ }
2100
+
2101
+ //var param = "\"" + webExe + "\" \"" + buildPath + "\" " + port + (pid == -1 ? "" : " " + pid); // server exe path, build folder and port
2072
2102
2073
2103
var webglServerProcess = Tools . LaunchExe ( monoExe , param ) ;
2074
2104
0 commit comments