C# 将Texture2D保存在字典中,然后检索它

C# 将Texture2D保存在字典中,然后检索它,c#,unity3d,C#,Unity3d,我正在将Parse.com中的配置文件图像导入我的unity项目,并将它们插入字典列表,其中特定用户id为键,图像(Texture2D)为值,如下所示: public Dictionary<string, string> oppimageslinks = new Dictionary<string, string>(); public Dictionary<string, Texture2D> oppimages = new Dictionary<str

我正在将Parse.com中的配置文件图像导入我的unity项目,并将它们插入字典列表,其中特定用户id为键,图像(Texture2D)为值,如下所示:

public Dictionary<string, string> oppimageslinks = new Dictionary<string, string>();
public Dictionary<string, Texture2D> oppimages = new Dictionary<string, Texture2D>();

foreach(KeyValuePair<string, string> image in oppimageslinks){

    var oppImageRequest = new WWW(image.Value);
    yield return oppImageRequest;
    oppimages.Add(image.Key,oppImageRequest.texture);

}
public Dictionary oppimageslinks=new Dictionary();
公共字典=新字典();
foreach(opImagesLink中的KeyValuePair图像){
var oppImageRequest=newwww(image.Value);
提出退货申请;
添加(image.Key,oppmagerequest.texture);
}
这部分很好用。现在,我的问题是以后如何将纹理2D放入我的游戏对象中?以下是我试图做到这一点的方式:

if(oppimages.ContainsKey(game.Value[2])){
    UITexture picture = GameObject.Find("Game"+mc+"/Background/ProfileImg").GetComponent<UITexture>();
    picture.mainTexture = oppimages.Value;
}
if(oppimages.ContainsKey(game.Value[2])){
UITexture picture=GameObject.Find(“Game”+mc+“/Background/ProfileImg”).GetComponent();
picture.mainTexture=oppimages.Value;
}
game.Value[2]是当前对手的用户ID

尝试执行此操作时,我遇到以下错误:

类型
System.Collections.Generic.Dictionary'不包含
Value'的定义,并且找不到类型
System.Collections.Generic.Dictionary'的扩展方法(是否缺少using指令或程序集引用?)


我不知道如何解决这个问题,希望能在这件事上得到一些帮助。

我不知道发生了什么事。也许你可以试试这个

if(oppimages.ContainsKey(game.Value[2])){
UITexture picture = GameObject.Find("Game"+mc+"/Background/ProfileImg").GetComponent<UITexture>();
picture.mainTexture = oppimages[game.Value[2]];
}
if(oppimages.ContainsKey(game.Value[2])){
UITexture picture=GameObject.Find(“Game”+mc+“/Background/ProfileImg”).GetComponent();
picture.mainTexture=oppimages[game.Value[2];
}