@@ -596,10 +596,10 @@ private bool AcceptNonExistingFilename
596
596
}
597
597
598
598
private PickMode m_pickerMode = PickMode . Files ;
599
- private PickMode PickerMode
599
+ internal PickMode PickerMode
600
600
{
601
601
get { return m_pickerMode ; }
602
- set
602
+ private set
603
603
{
604
604
m_pickerMode = value ;
605
605
@@ -633,7 +633,7 @@ internal bool AllowMultiSelection
633
633
internal bool MultiSelectionToggleSelectionMode
634
634
{
635
635
get { return m_multiSelectionToggleSelectionMode ; }
636
- set
636
+ private set
637
637
{
638
638
if ( m_multiSelectionToggleSelectionMode != value )
639
639
{
@@ -754,7 +754,7 @@ private void LateUpdate()
754
754
contextMenu . Hide ( ) ;
755
755
}
756
756
757
- #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WSA || UNITY_WSA_10_0
757
+ #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL || UNITY_WSA || UNITY_WSA_10_0
758
758
// Handle keyboard shortcuts
759
759
if ( ! EventSystem . current . currentSelectedGameObject )
760
760
{
@@ -1361,9 +1361,15 @@ public void OnItemSelected( FileBrowserItem item, bool isDoubleClick )
1361
1361
return ;
1362
1362
}
1363
1363
1364
- // We want to toggle the selected states of the files even when they are double clicked
1365
1364
if ( m_multiSelectionToggleSelectionMode )
1365
+ {
1366
+ // In file selection mode, we shouldn't include folders in the multi-selection
1367
+ if ( item . IsDirectory && m_pickerMode == PickMode . Files && ! selectedFileEntries . Contains ( item . Position ) )
1368
+ return ;
1369
+
1370
+ // If a file/folder is double clicked in multi-selection mode, instead of opening that file/folder, we want to toggle its selected state
1366
1371
isDoubleClick = false ;
1372
+ }
1367
1373
1368
1374
if ( ! isDoubleClick )
1369
1375
{
@@ -1374,7 +1380,7 @@ public void OnItemSelected( FileBrowserItem item, bool isDoubleClick )
1374
1380
}
1375
1381
else
1376
1382
{
1377
- #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WSA || UNITY_WSA_10_0
1383
+ #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL || UNITY_WSA || UNITY_WSA_10_0
1378
1384
// When Shift key is held, all items from the pivot item to the clicked item will be selected
1379
1385
if ( Input . GetKey ( KeyCode . LeftShift ) || Input . GetKey ( KeyCode . RightShift ) )
1380
1386
{
@@ -1395,7 +1401,7 @@ public void OnItemSelected( FileBrowserItem item, bool isDoubleClick )
1395
1401
multiSelectionPivotFileEntry = item . Position ;
1396
1402
1397
1403
// When in toggle selection mode or Control key is held, individual items can be multi-selected
1398
- #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WSA || UNITY_WSA_10_0
1404
+ #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL || UNITY_WSA || UNITY_WSA_10_0
1399
1405
if ( m_multiSelectionToggleSelectionMode || Input . GetKey ( KeyCode . LeftControl ) || Input . GetKey ( KeyCode . RightControl ) )
1400
1406
#else
1401
1407
if ( m_multiSelectionToggleSelectionMode )
@@ -1458,6 +1464,33 @@ public void OnItemSelected( FileBrowserItem item, bool isDoubleClick )
1458
1464
}
1459
1465
}
1460
1466
1467
+ public void OnItemHeld ( FileBrowserItem item )
1468
+ {
1469
+ if ( item is FileBrowserQuickLink )
1470
+ OnItemSelected ( item , false ) ;
1471
+ else if ( m_allowMultiSelection && ( ! item . IsDirectory || m_pickerMode != PickMode . Files ) ) // Holding a folder in file selection mode should do nothing
1472
+ {
1473
+ if ( ! MultiSelectionToggleSelectionMode )
1474
+ {
1475
+ if ( m_pickerMode == PickMode . Files )
1476
+ {
1477
+ // If some folders are selected in file selection mode, deselect these folders before enabling the selection toggles because otherwise,
1478
+ // user won't be able to deselect the selected folders without exiting MultiSelectionToggleSelectionMode
1479
+ for ( int i = selectedFileEntries . Count - 1 ; i >= 0 ; i -- )
1480
+ {
1481
+ if ( validFileEntries [ selectedFileEntries [ i ] ] . IsDirectory )
1482
+ selectedFileEntries . RemoveAt ( i ) ;
1483
+ }
1484
+ }
1485
+
1486
+ MultiSelectionToggleSelectionMode = true ;
1487
+ }
1488
+
1489
+ if ( ! selectedFileEntries . Contains ( item . Position ) )
1490
+ OnItemSelected ( item , false ) ;
1491
+ }
1492
+ }
1493
+
1461
1494
#if ! UNITY_EDITOR && UNITY_ANDROID
1462
1495
private void OnSAFDirectoryPicked ( string rawUri , string name )
1463
1496
{
0 commit comments