- Home /
This question was
closed Sep 10, 2013 at 01:03 PM by
aldonaletto for the following reason:
Duplicate Question: http://answers.unity3d.com/questions/534089/error-assigning-to-a-variable-2.html#answer-534101
Question by
Benifir · Sep 10, 2013 at 12:40 PM ·
c#errorforeachassign-variable
Error assigning to a variable
How could I get around this problem?
Assets/Chat/Chat.cs(140,25): error CS1656: Cannot assign to `entry' because it is a 'foreach iteration variable'
foreach(string entry in scrollingNotices) {
GUILayout.BeginHorizontal();
entry = GUILayout.TextField(entry);
Comment
I think it is saying you cant use variable 'entry' with OnGUI() as the SCOPE of entry is only within that foreach. In other words, the variable can not exist outside of the loop.
Follow this Question
Related Questions
Error assigning to a variable 0 Answers
Error assigning to a variable 1 Answer
Foreach Error 1 Answer
Targeting Issue Error 1 Answer
Multiple Cars not working 1 Answer