I need help with the code, please.


I have no idea what to do here. I will be extremely grateful if anyone can figure this out.

Line 38 - add ‘}’ at end of line.

Lines 50 & 54 have different capitalisation. Consider using ‘_colorComponent’ for the private version for clarity and to avoid the name conflict with line 52.

the error for Lines 50 and 54 worked. Thanks. But, I ran into another issue. 3189524--243513--Untitled.png

The error messages in red tell you what to look for. It’s generally best to fix the earliest one first, so find out why ‘)’ is unexpected on line 71 and work on that.

I don’t mean to sound desperate, I’ve been trying for 20 minutes. I can’t figure out what to do.

Line 71 you have a ) when you meant to put (.

1 Like

‘(’ and ‘)’ come in pairs, so do ‘{’ and ‘}’. Find what needs changing so you have equal amounts of both opening and closing versions.

I tried that on all the )'s.

I will try that. I’m still very new at c# coding.

Unexpected symbol almost always means something immediately before the symbol was wrong. In this case it’s a bracket the wrong direction.

2 Likes

If you are still struggling, your errors lie within line 71 of your script image.
Like @DominoM mentioned, generally you want to pay close attention to the top-most errors and definitely look for matching pairs of parentheses, brackets, and curly braces.

1 Like

Thanks, I figured most of them out, but I got one more to figure out if you don’t mind. This: 3190041--243583--Untitled.png

This is yours:
ContainsKey)newColor))

This is the fixed version:
ContainsKey(newColor))

Brackets and braces always contain something so they are paired around () {}.

You really should be using code tags.

The correct line is:

if(colorSpriteDict.ContainsKey(newColor)){

Note the direction of the brackets.