So you know, there’s no such thing as Unity 2D (there are 2D features yes) but your post isn’t related to any 2D feature so I’ll move your post to the scripting forum.
Your post is extremely vague and you don’t provide any detail such as posting the script itself (using code-tags ) so you only allowing devs to make random guesses at what it might be.
Having a NullReferenceException is the most common mistake beginners panic about because of not understand C# and what a reference type is. So much so that there’s a pinned post about it here .
I see a “MoveNext” so it’s like that you’re using ForEach or some enumerator which is NULL. Often this can be caused by you deleting something in the list/array you’re going through.