Hello, I'm a newbie. Code (CSharp): int A = 5; int B; void FuctionA() { if (B = A +- 2) { Debug.Log("Something Happen"); } } As you can see here the code is bugging because I don't know how to write it correctly. I'm trying to tell Unity that if B = A plus 2 (6,7) or minus 2 (4,3) then something happens. Thank you.
First, you have to use double '=' for comparison. Then code would be: Code (CSharp): if (B == A + 2 || B == A - 2)
When learning a new programming language, it's far more efficient to read its documentation about basic syntax and features that ask around on forums: https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/tutorials/