一个兼容性问题

代码片段1:let words = [1,2,3,4,5,6]
words.forEach(e => {
let word = instantiate(this.wordPrefab);
if (this.missionId !== 4) {
word.getComponentInChildren(RichText).string = e
word.getComponentInChildren(Sprite).color = Color.BLACK
} else {
word.getComponentInChildren(RichText).string = e.words
word.getComponentInChildren(Sprite).color = e.color
}
this.irritants.push(word);
});
代码片段2:
let words = [1,2,3,4,5,6]
words.forEach(e => {

        if (this.missionId !== 4) {
            this.wordPrefab.data.getComponentInChildren(RichText).string = e
            this.wordPrefab.data.getComponentInChildren(Sprite).color = Color.BLACK
        } else {
            this.wordPrefab.data.getComponentInChildren(RichText).string = e.words
            this.wordPrefab.data.getComponentInChildren(Sprite).color = e.color
        }
        let word = instantiate(this.wordPrefab);
        this.irritants.push(word);
    });

这两段代码在浏览器跟真机中运行结果不一样,有大佬知道为啥不