Invalid AABB inAABB UnityEngine.Canvas:SendWillRenderCanvases()的解决办法

Posted 实现梦想与回忆的,叫做现在

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Invalid AABB inAABB UnityEngine.Canvas:SendWillRenderCanvases()的解决办法相关的知识,希望对你有一定的参考价值。

我遇到这个问题的情况是, 在Start()中直接使用WWW价值本地图片,可能是加载图片相对比较耗时,就出现了这个错误。

解决的办法是使用协程:

// Use this for initialization
	void Start () {

		AddSampleData ();
	
	}

	void AddSampleData(){
	StartCoroutine(WaitLoadImage("/Users/xxxx/xxx/xxx.jpg", go));
	}

	IEnumerator WaitLoadImage(string fileName, GameObject targetGameObject)
	{
		RectTransform rectTransform = targetGameObject.GetComponent<RectTransform> ();
		WWW www=new WWW("file://"+fileName);
		Image img = targetGameObject.GetComponent<Image> ();

		Debug.Log(www.url);

		yield return www;

		Rect spriteRect = new Rect (0, 0, www.texture.width, www.texture.height);
		Sprite imageSprite = Sprite.Create (www.texture, spriteRect, new Vector2 (0.5f, 0.5f));
		img.sprite = imageSprite;

	}

  

以上是关于Invalid AABB inAABB UnityEngine.Canvas:SendWillRenderCanvases()的解决办法的主要内容,如果未能解决你的问题,请参考以下文章

Unity 报错解决方法:Standard Shader Invalid Subscript uv2 error

Unity: Invalid serialized file version xxx Expected version: 5.3.4f1. Actual version: 5.3.5f1.

Unity3d 2020版本发布WebGL报错Uncaught SyntaxError: Invalid or unexpected token 和unityFramework is not...修正

Unity Error executing result=instance->m_Sound->lock()An invalid parameter was passed to this func

立即从 3D 管道访问 2D 框的 Unity 功能?

Unity Error executing result=instance->m_Sound->lock()An invalid parameter was passed to this func