K
K
Kirill Kichigin2017-03-30 12:31:50
Unity
Kirill Kichigin, 2017-03-30 12:31:50

Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement error in script. How to fix?

So I am writing a small connecting script, I
wrote it, I save it, I go to Unity,
and he hints at this script and writes that this error is in it.
Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FoodEat : MonoBehaviour {
  public int Tiod = 0;
  public void Buy()
  {
    Tiod == 1;
  }
}

Where did I go wrong?
*The error is in the title of the question.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2017-03-30
@KiR_Ka

Double equals is a comparison, single is an assignment
https://msdn.microsoft.com/en-us/library/sbkb459w.aspx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question