Skip to content

[macOS] [Editor] NullReferenceException in DisplayUGUI.GetDrawingDimensions when MediaPlayer.Info is null #2501

Description

@mittan1330

Unity version

6000.3.19f1

Unity editor platform

macOS

AVPro Video edition

Ultra

AVPro Video version

3.4.2

Device hardware

Mac M4 Max

Which macOS version are you using?

15.7.5

Texture format

BGRA

Audio output

System Direct

Any other Media Player component configuration required to reproduce the issue.

Multiple MediaPlayer and DisplayUGUI components are created dynamically at runtime.
Each player has its own DisplayUGUI component. The components are destroyed when the video view is disposed.
The issue occurs in the macOS Unity Editor.

Which output component(s) are you using?

Display uGUI

Any other component configuration required to reproduce the issue.

No special configuration is required.
The issue appears to be related to the [ExecuteInEditMode] behavior added to DisplayUGUI. It occurs during a uGUI Canvas rebuild while the MediaPlayer is being initialized or disposed.

The issue

After upgrading AVPro Video Ultra from 3.3.3 to 3.4.2, we occasionally see the following exception when running the project in the macOS Unity Editor:

NullReferenceException: Object reference not set to an instance of an object
RenderHeads.Media.AVProVideo.DisplayUGUI.GetDrawingDimensions
    (UnityEngine.ScaleMode scaleMode, UnityEngine.Rect& uvRect)
    (at Assets/AVProVideo/Extensions/UnityUI/Runtime/DisplayUGUI.cs:620)
RenderHeads.Media.AVProVideo.DisplayUGUI._OnFillVBO
    (System.Collections.Generic.List`1[T] vbo)
    (at Assets/AVProVideo/Extensions/UnityUI/Runtime/DisplayUGUI.cs:547)
RenderHeads.Media.AVProVideo.DisplayUGUI.OnPopulateMesh
    (UnityEngine.UI.VertexHelper vh)
    (at Assets/AVProVideo/Extensions/UnityUI/Runtime/DisplayUGUI.cs:533)

We suspect that the following access to MediaPlayer.Info in GetDrawingDimensions() may be related:

_mediaPlayer.Info.GetTextureTransform()

HasValidTexture() checks MediaPlayer and TextureProducer, but it does not appear to check whether MediaPlayer.Info is available. It may therefore be possible for this code to run while Info is null, for example during player initialization or disposal.
Adding a null check for MediaPlayer.Info appears to prevent the exception in our project. Could you please confirm whether this is a known issue?

Media information

No response

Log output

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

FixedA fix will be in the next releaseUnityAn issue with AVPro Video and Unity that's not specific to any platform

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions