- Home /
The question is answered, right answer was accepted
[Anwsered] For loop does not work (not logic problem nor missing semicolon)
Good evening everyone, I was trying to make simple script in unity, but stumpled upon problem when trying using 'for' loop. Originally I was using JetBrains, then installed VS, but the problem remained. I have tried changin Api Compatibility Level, but it did not help either. I am guessing that i might have set up Unity or VS incorrectly, but again, I do not know how to fix it.
Software I am using: Unity version 2019.4.11f1 Visual Studio 2019
You are not inside a function. You cannot use a for loop outside one, as this would be in a general scope and its simply not supported by the language
That was it and now I am a little embarassed that i did not know that :P Anyway thanks a lot Klarzahs!
Follow this Question
Related Questions
Use The Force Luke 1 Answer
What is the order of execution in a for loop? 1 Answer
Use for-i-loop var outside the loop 2 Answers
Problem with raycasts in a for loop 2 Answers
Setting up an 2d grid in C# 3 Answers