How to Reproduce:
1. Open the attached “IN-149264” project
2. Open “SampleScene”
3. Open the “TestScript.cs” file
4. Note that public Sprite spriteA; is present in the “TestScript.cs” file
5. In Unity, From the Hierarchy window, select the “TestObject” GameObject
6. From Asset, drag and drop the “PlayerSprites.png” to the Animation window
7. From the pop-up select “SpriteRenderer”
8. Observe the result
Actual Result: NullReferenceException error in Console window and no changes in animation clip
Expected Result: No errors in the Console window and New property for “PlayerSprites” is added to animation clip
Reproducible with: 6000.0.0f1, 6000.0.80f1, 6000.3.21f1, 6000.5.6f1, 6000.6.0b6, 6000.7.0a4
Reproducible on: Windows 11
Not reproducible on: No other environments tested
Notes:
- Not only selecting “spriteRenderer” but also selecting “TestScript” from the pop-up reproduces the same issue
- Removing public Sprite spriteA; line form the “TestScript.cs” fixes this issue
- Only Serialized variables reproduces this issue. For Example: public Sprite spriteA;,[SerializeField]private Sprite spriteA; and [SerializeField]protected Sprite spriteA; reproduces this issue but private Sprite spriteA; and protected Sprite spriteA; does not reproduces this issue