C# Unity CS0308错误:非泛型方法不能与类型参数一起使用

C# Unity CS0308错误:非泛型方法不能与类型参数一起使用,c#,generics,unity3d,google-vr,C#,Generics,Unity3d,Google Vr,我试图在Unity3D中构建一个游戏,我正在使用Unity 5.1.1 pro版本,我已经导入了Google VR sdk,我得到了这个错误 void Awake() { #if !UNITY_5_2 // im getting a error on this line GetComponentInChildren<VideoControlsManager>(true).Player = player; #else GetComponent

我试图在Unity3D中构建一个游戏,我正在使用Unity 5.1.1 pro版本,我已经导入了Google VR sdk,我得到了这个错误

void Awake() {
#if !UNITY_5_2
         // im getting a error on this line 
        GetComponentInChildren<VideoControlsManager>(true).Player = player;
#else
    GetComponentInChildren<VideoControlsManager>().Player = player;
#endif
  }
}
void Awake(){
#如果!团结
//我在这条线上遇到了一个错误
getComponentChildren(true).Player=Player;
#否则
getComponentChildren().Player=Player;
#恩迪夫
}
}
根据的第一行,没有可接受的
。但是示例使用了
。你可以提交一张票,看看哪个是正确的。由于这个错误,我怀疑定义行是正确的书写方式。所以

这样写你的台词:

GetComponentInChildren(typeof(VideoControlsManager)).Player = player;

您可以使用
Component.GetComponentsInChildren
,因为它需要一个布尔值来包含非活动对象,但由于它返回一个数组,您可以使用
ForEach
将变量分配给每个元素

 public VideoControlsManager[] VideoControlsManagers;
VideoControlsManagers = GetComponentsInChildren<VideoControlsManager>(true);

        foreach( VideoControlsManager v in VideoControlsManagers )
            v.Player  = player;
公共VideoControlsManager[]VideoControlsManager;
VideoControlsManager=GetComponentsInChildren(真);
foreach(VideoControlsManager中的VideoControlsManager v)
v、 玩家=玩家;

您是否检查了5.1.1中GetComponentChildren的签名?