@@ -125,8 +125,10 @@ public class Error : Wrapper {
125
125
public Error ( object error ) : base ( error ) {
126
126
type = type ??
127
127
VersionHandler . FindClass ( "UnityEditor" , "UnityEditor.PackageManager.Error" ) ;
128
- errorCodeProperty = errorCodeProperty ?? type . GetProperty ( "errorCode" ) ;
129
- messageProperty = messageProperty ?? type . GetProperty ( "message" ) ;
128
+ if ( type != null ) {
129
+ errorCodeProperty = errorCodeProperty ?? type . GetProperty ( "errorCode" ) ;
130
+ messageProperty = messageProperty ?? type . GetProperty ( "message" ) ;
131
+ }
130
132
instance = error ;
131
133
fallbackMessage = instance != null ? "Package Manager Not Supported" : "" ;
132
134
}
@@ -199,9 +201,11 @@ public class AuthorInfo : Wrapper {
199
201
public AuthorInfo ( object authorInfo ) : base ( authorInfo ) {
200
202
type = type ??
201
203
VersionHandler . FindClass ( "UnityEditor" , "UnityEditor.PackageManager.AuthorInfo" ) ;
202
- emailProperty = emailProperty ?? type . GetProperty ( "email" ) ;
203
- nameProperty = nameProperty ?? type . GetProperty ( "name" ) ;
204
- urlProperty = urlProperty ?? type . GetProperty ( "url" ) ;
204
+ if ( type != null ) {
205
+ emailProperty = emailProperty ?? type . GetProperty ( "email" ) ;
206
+ nameProperty = nameProperty ?? type . GetProperty ( "name" ) ;
207
+ urlProperty = urlProperty ?? type . GetProperty ( "url" ) ;
208
+ }
205
209
instance = authorInfo ;
206
210
}
207
211
@@ -267,8 +271,10 @@ public DependencyInfo(object dependencyInfo) : base(dependencyInfo) {
267
271
type = type ??
268
272
VersionHandler . FindClass ( "UnityEditor" ,
269
273
"UnityEditor.PackageManager.DependencyInfo" ) ;
270
- nameProperty = nameProperty ?? type . GetProperty ( "name" ) ;
271
- versionProperty = versionProperty ?? type . GetProperty ( "version" ) ;
274
+ if ( type != null ) {
275
+ nameProperty = nameProperty ?? type . GetProperty ( "name" ) ;
276
+ versionProperty = versionProperty ?? type . GetProperty ( "version" ) ;
277
+ }
272
278
instance = dependencyInfo ;
273
279
}
274
280
@@ -338,12 +344,14 @@ public VersionsInfo() {}
338
344
public VersionsInfo ( object versionsInfo ) : base ( versionsInfo ) {
339
345
type = type ??
340
346
VersionHandler . FindClass ( "UnityEditor" , "UnityEditor.PackageManager.VersionsInfo" ) ;
341
- allProperty = allProperty ?? type . GetProperty ( "all" ) ;
342
- compatibleProperty = compatibleProperty ?? type . GetProperty ( "compatible" ) ;
343
- latestProperty = latestProperty ?? type . GetProperty ( "latest" ) ;
344
- latestCompatibleProperty = latestCompatibleProperty ??
345
- type . GetProperty ( "latestCompatible" ) ;
346
- recommendedProperty = recommendedProperty ?? type . GetProperty ( "recommended" ) ;
347
+ if ( type != null ) {
348
+ allProperty = allProperty ?? type . GetProperty ( "all" ) ;
349
+ compatibleProperty = compatibleProperty ?? type . GetProperty ( "compatible" ) ;
350
+ latestProperty = latestProperty ?? type . GetProperty ( "latest" ) ;
351
+ latestCompatibleProperty = latestCompatibleProperty ??
352
+ type . GetProperty ( "latestCompatible" ) ;
353
+ recommendedProperty = recommendedProperty ?? type . GetProperty ( "recommended" ) ;
354
+ }
347
355
instance = versionsInfo ;
348
356
}
349
357
@@ -473,18 +481,20 @@ public PackageInfo() {}
473
481
/// <param name="packageInfo">PackageInfo to wrap.</param>
474
482
public PackageInfo ( object packageInfo ) : base ( packageInfo ) {
475
483
var type = Type ;
476
- authorProperty = authorProperty ?? type . GetProperty ( "author" ) ;
477
- categoryProperty = categoryProperty ?? type . GetProperty ( "category" ) ;
478
- dependenciesProperty = dependenciesProperty ?? type . GetProperty ( "dependencies" ) ;
479
- descriptionProperty = descriptionProperty ?? type . GetProperty ( "description" ) ;
480
- displayNameProperty = displayNameProperty ?? type . GetProperty ( "displayName" ) ;
481
- keywordsProperty = keywordsProperty ?? type . GetProperty ( "keywords" ) ;
482
- nameProperty = nameProperty ?? type . GetProperty ( "name" ) ;
483
- packageIdProperty = packageIdProperty ?? type . GetProperty ( "packageId" ) ;
484
- resolvedDependenciesProperty = resolvedDependenciesProperty ??
485
- type . GetProperty ( "resolvedDependencies" ) ;
486
- versionProperty = versionProperty ?? type . GetProperty ( "version" ) ;
487
- versionsProperty = versionsProperty ?? type . GetProperty ( "versions" ) ;
484
+ if ( type != null ) {
485
+ authorProperty = authorProperty ?? type . GetProperty ( "author" ) ;
486
+ categoryProperty = categoryProperty ?? type . GetProperty ( "category" ) ;
487
+ dependenciesProperty = dependenciesProperty ?? type . GetProperty ( "dependencies" ) ;
488
+ descriptionProperty = descriptionProperty ?? type . GetProperty ( "description" ) ;
489
+ displayNameProperty = displayNameProperty ?? type . GetProperty ( "displayName" ) ;
490
+ keywordsProperty = keywordsProperty ?? type . GetProperty ( "keywords" ) ;
491
+ nameProperty = nameProperty ?? type . GetProperty ( "name" ) ;
492
+ packageIdProperty = packageIdProperty ?? type . GetProperty ( "packageId" ) ;
493
+ resolvedDependenciesProperty = resolvedDependenciesProperty ??
494
+ type . GetProperty ( "resolvedDependencies" ) ;
495
+ versionProperty = versionProperty ?? type . GetProperty ( "version" ) ;
496
+ versionsProperty = versionsProperty ?? type . GetProperty ( "versions" ) ;
497
+ }
488
498
}
489
499
490
500
/// <summary>
@@ -642,8 +652,10 @@ public Request(object request) : base(request) {
642
652
type = type ??
643
653
VersionHandler . FindClass ( "UnityEditor" ,
644
654
"UnityEditor.PackageManager.Requests.Request" ) ;
645
- errorProperty = errorProperty ?? type . GetProperty ( "Error" ) ;
646
- isCompletedProperty = isCompletedProperty ?? type . GetProperty ( "IsCompleted" ) ;
655
+ if ( type != null ) {
656
+ errorProperty = errorProperty ?? type . GetProperty ( "Error" ) ;
657
+ isCompletedProperty = isCompletedProperty ?? type . GetProperty ( "IsCompleted" ) ;
658
+ }
647
659
}
648
660
649
661
/// <summary>
@@ -690,7 +702,9 @@ public CollectionRequest(object request, string typeName) : base(request) {
690
702
collectionRequestType =
691
703
VersionHandler . FindClass ( "UnityEditor" ,
692
704
"UnityEditor.PackageManager.Requests." + typeName ) ;
693
- resultProperty = collectionRequestType . GetProperty ( "Result" ) ;
705
+ if ( collectionRequestType != null ) {
706
+ resultProperty = collectionRequestType . GetProperty ( "Result" ) ;
707
+ }
694
708
}
695
709
696
710
/// <summary>
@@ -727,7 +741,9 @@ public AddRequest(object request) : base(request) {
727
741
addRequestType = addRequestType ??
728
742
VersionHandler . FindClass ( "UnityEditor" ,
729
743
"UnityEditor.PackageManager.Requests.AddRequest" ) ;
730
- resultProperty = resultProperty ?? addRequestType . GetProperty ( "Result" ) ;
744
+ if ( addRequestType != null ) {
745
+ resultProperty = resultProperty ?? addRequestType . GetProperty ( "Result" ) ;
746
+ }
731
747
}
732
748
733
749
/// <summary>
@@ -764,7 +780,9 @@ public RemoveRequest(object request) : base(request) {
764
780
removeRequestType = removeRequestType ??
765
781
VersionHandler . FindClass ( "UnityEditor" ,
766
782
"UnityEditor.PackageManager.Requests.RemoveRequest" ) ;
767
- resultProperty = resultProperty ?? removeRequestType . GetProperty ( "PackageIdOrName" ) ;
783
+ if ( removeRequestType != null ) {
784
+ resultProperty = resultProperty ?? removeRequestType . GetProperty ( "PackageIdOrName" ) ;
785
+ }
768
786
}
769
787
770
788
/// <summary>
@@ -847,13 +865,15 @@ private static class Client {
847
865
static Client ( ) {
848
866
type = type ??
849
867
VersionHandler . FindClass ( "UnityEditor" , "UnityEditor.PackageManager.Client" ) ;
850
- addMethod = addMethod ?? type . GetMethod ( "Add" , new [ ] { typeof ( String ) } ) ;
851
- removeMethod = removeMethod ?? type . GetMethod ( "Remove" , new [ ] { typeof ( String ) } ) ;
852
- listMethod = listMethod ?? type . GetMethod ( "List" , Type . EmptyTypes ) ;
853
- listMethodOfflineMode =
854
- listMethodOfflineMode ?? type . GetMethod ( "List" , new [ ] { typeof ( bool ) } ) ;
855
- searchMethod = searchMethod ?? type . GetMethod ( "Search" , new [ ] { typeof ( String ) } ) ;
856
- searchAllMethod = searchAllMethod ?? type . GetMethod ( "SearchAll" , Type . EmptyTypes ) ;
868
+ if ( type != null ) {
869
+ addMethod = addMethod ?? type . GetMethod ( "Add" , new [ ] { typeof ( String ) } ) ;
870
+ removeMethod = removeMethod ?? type . GetMethod ( "Remove" , new [ ] { typeof ( String ) } ) ;
871
+ listMethod = listMethod ?? type . GetMethod ( "List" , Type . EmptyTypes ) ;
872
+ listMethodOfflineMode =
873
+ listMethodOfflineMode ?? type . GetMethod ( "List" , new [ ] { typeof ( bool ) } ) ;
874
+ searchMethod = searchMethod ?? type . GetMethod ( "Search" , new [ ] { typeof ( String ) } ) ;
875
+ searchAllMethod = searchAllMethod ?? type . GetMethod ( "SearchAll" , Type . EmptyTypes ) ;
876
+ }
857
877
}
858
878
859
879
/// <summary>
0 commit comments