public void SetTexture2D(MovieTexture tex) { this.oggTexture = tex; renderer.material.SetTexture("_MainTex", tex); // In order to get texture size, we have to play the texture for one frame. // this is a known bug in unity. // http://forum.unity3d.com/threads/71220-get-MovieTexture-resolution tex.Play(); tex.Pause(); tex.loop = this.isLooping; this.textureAspectRatio = (float)tex.width / tex.height; }