Unity3d webplayer Error(1)

来源:互联网 发布:身份证号验证js 编辑:程序博客网 时间:2024/04/30 00:00

最近在测试一个项目的时候,出现了很多的error。现在记录以便日后浏览,便快速解决问题。 

错误如下:

"content was stopped because a fatal content"

解决方案:


1、不要使用Component.GetComponent 方法


比如:


void TestBehaviourFunc()


{

Renderer myRenderer = GetComponent<Renderer>();


}

建议使用:

void TestBehaviourFunc()


{

Renderer myRenderer = gameObject.GetComponent<Renderer>();

}

2、泛型的使用


比如:

class TestGeneric<T>


{

public TestFunc<G>()


{

}

}


建议使用:



class TestGeneric<T>


{


public TestFunc(Type secondType)

{

}

}


通过上诉方式,可以解决webplayer出错的现象。


要是还是不解决:


1、请查看webplayer插件的版本是unity是否匹配


2、清除电脑中的cache


3、清除浏览器的cache


原创粉丝点击