I am trying to convert Unity UnityScript to C#. I am getting this error:
Assets/Scripts/BoostPlatformCheck.cs(40,36): error CS0019: Operator
==' cannot be applied to operands of typeint' and `object'
Here is the C# code:
int collidedWith = collisionInfo.gameObject.GHetInstanceID();
ArrayList collided = new ArrayList();
....
if(collidedWith == collided[collided.Count - i - 1])
{
alreadyExists = true;
return;
}
I changed Array to ArrayList and collided.length to collided.Count when I converted it from JS to C#.
if(collidedWith ==Convert.ToInt32(collided[collided.Count - i - 1]))ArrayList? If they're all the same thing - which it appears they are;ints - then you should be using aList<int>.. which will allow your comparison. Also, don't do what Tim said to do above this comment.ArrayListfrom .NET 2 and onward. Certainly not in this simple instance anyway.