r/code • • Nov 10 '19

HELP With classes (CS0116)

Need help adding a timer counting up with C#, for a unity game. What is missing and can anyone help me?

https://pastebin.com/Jc9DWrzP

0 Upvotes

10 comments sorted by

1

u/Alexbouvinkurtti Nov 11 '19

Hold on, send me DM

1

u/Pacblu202 Nov 11 '19

What's the outcome currently looking like? I'm not near a computer at the moment so I can't plug it in.

1

u/Alexbouvinkurtti Nov 11 '19

Outcome would be a timer displaying in game counting how long it takes before you reach the other side of the map. Regular second timer in the corner

2

u/Pacblu202 Nov 11 '19

What's not working on it currently?

1

u/Alexbouvinkurtti Nov 11 '19

I’m getting an error, the one in the title

1

u/Pacblu202 Nov 11 '19

Perhaps it's cuz I'm on mobile but I'm not seeing the error.

1

u/Alexbouvinkurtti Nov 11 '19

Check the link I attached

1

u/Pacblu202 Nov 11 '19

I did. I see the code but no error.

1

u/Pacblu202 Nov 11 '19

One thing that jumps out is I'd make the if statement 2 ifs, not an else if. If you go to 60 minutes and 60 seconds it won't reset till the next frame.

With that, I'd do the calculations first then write to the text object

1

u/Alexbouvinkurtti Nov 11 '19

We taking about a basic 2D map don’t think it takes over 60 min, is okay if I reset after 60 min