Skip to content

Incorrect NotNullAttribute on UnityEngine.Component.transform #2455

Closed
@ymfact

Description

@ymfact

There is an issue with the incorrect usage of NotNullAttribute in the UnityEngine.Component.transform property.

In the file resharper-unity/resharper/resharper-unity/src/annotations/UnityEngine.xml, the following entry is present:

<member name="P:UnityEngine.Component.transform">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
</member>

This annotation is incorrect because the transform property can indeed be null in certain scenarios. For example, when the GameObject to which the MonoBehaviour is attached is destroyed, but a lambda capturing this remains, the transform property will return null.

As such, using NotNullAttribute is inappropriate and misleading in this context. To accurately reflect the behavior of the transform property, the NotNullAttribute should be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions