11// new argument was added in 19.1.4
22
3- #if ( UNITY_2019_1_OR_NEWER && ! UNITY_2019_1_0 && ! UNITY_2019_1_1 && ! UNITY_2019_1_2 && ! UNITY_2019_1_3 ) || ( UNITY_2018_4_OR_NEWER && ! UNITY_2018_4_0 && ! UNITY_2018_4_1 && ! UNITY_2018_4_2 )
3+ #if UNITY_2019_3_OR_NEWER
4+ #define CS_P2F_NEW_ARGUMENT_2
5+ #elif ( UNITY_2019_1_OR_NEWER && ! UNITY_2019_1_0 && ! UNITY_2019_1_1 && ! UNITY_2019_1_2 && ! UNITY_2019_1_3 ) || ( UNITY_2018_4_OR_NEWER && ! UNITY_2018_4_0 && ! UNITY_2018_4_1 && ! UNITY_2018_4_2 )
46#define CS_P2F_NEW_ARGUMENT
57#endif
68
1113
1214namespace CodeStage . PackageToFolder
1315{
14- public class Package2Folder
16+ public static class Package2Folder
1517 {
1618 ///////////////////////////////////////////////////////////////
1719 // Delegates and properties with caching for reflection stuff
1820 ///////////////////////////////////////////////////////////////
1921
2022 #region reflection stuff
2123
22- #if CS_P2F_NEW_ARGUMENT
24+ #if CS_P2F_NEW_ARGUMENT_2
25+ private delegate object [ ] ExtractAndPrepareAssetListDelegate ( string packagePath , out string packageIconPath , out string packageManagerDependenciesPath ) ;
26+ #elif CS_P2F_NEW_ARGUMENT
2327 private delegate object [ ] ExtractAndPrepareAssetListDelegate ( string packagePath , out string packageIconPath , out bool allowReInstall , out string packageManagerDependenciesPath ) ;
2428#else
2529 private delegate object [ ] ExtractAndPrepareAssetListDelegate ( string packagePath , out string packageIconPath , out bool allowReInstall ) ;
@@ -142,12 +146,15 @@ private static void Package2FolderCommand()
142146 public static void ImportPackageToFolder ( string packagePath , string selectedFolderPath , bool interactive )
143147 {
144148 string packageIconPath ;
149+ #if CS_P2F_NEW_ARGUMENT_2
150+ string packageManagerDependenciesPath ;
151+ var assetsItems = ExtractAndPrepareAssetList ( packagePath , out packageIconPath , out packageManagerDependenciesPath ) ;
152+ #elif CS_P2F_NEW_ARGUMENT
145153 bool allowReInstall ;
146-
147- #if CS_P2F_NEW_ARGUMENT
148154 string packageManagerDependenciesPath ;
149155 var assetsItems = ExtractAndPrepareAssetList ( packagePath , out packageIconPath , out allowReInstall , out packageManagerDependenciesPath ) ;
150156#else
157+ bool allowReInstall ;
151158 var assetsItems = ExtractAndPrepareAssetList ( packagePath , out packageIconPath , out allowReInstall ) ;
152159#endif
153160
@@ -160,7 +167,12 @@ public static void ImportPackageToFolder(string packagePath, string selectedFold
160167
161168 if ( interactive )
162169 {
170+ #if CS_P2F_NEW_ARGUMENT_2
171+ ShowImportPackageWindow ( packagePath , assetsItems , packageIconPath ) ;
172+ #else
163173 ShowImportPackageWindow ( packagePath , assetsItems , packageIconPath , allowReInstall ) ;
174+ #endif
175+
164176 }
165177 else
166178 {
@@ -174,11 +186,17 @@ private static void ChangeAssetItemPath(object assetItem, string selectedFolderP
174186 destinationPath = selectedFolderPath + destinationPath . Remove ( 0 , 6 ) ;
175187 DestinationAssetPathFieldInfo . SetValue ( assetItem , destinationPath ) ;
176188 }
177-
189+ #if CS_P2F_NEW_ARGUMENT_2
190+ public static void ShowImportPackageWindow ( string path , object [ ] array , string packageIconPath )
191+ {
192+ ShowImportPackageMethodInfo . Invoke ( null , new object [ ] { path , array , packageIconPath } ) ;
193+ }
194+ #else
178195 public static void ShowImportPackageWindow ( string path , object [ ] array , string packageIconPath , bool allowReInstall )
179196 {
180197 ShowImportPackageMethodInfo . Invoke ( null , new object [ ] { path , array , packageIconPath , allowReInstall } ) ;
181198 }
199+ #endif
182200
183201 public static void ImportPackageSilently ( object [ ] assetsItems )
184202 {
0 commit comments