What is the syntax for stream.ReceiveNext() in javascript?

legend411 ✭✭
correctPos = (Vector3)stream.ReceiveNext();

throws an semicolon error?


  • Thats because the typecast there is invalid.
    Unity Javascript does not support this type of casts, you can only cast with as TargetType, not with (TargetType)

    And you don't need to cast it, if correctPos is declared as var correctPos:Vector3 it will be autocasted (and thats needed cause value types can't be casted with as TargetType casts)
  • Oh gotcha, yeah it is indeed declared, as a private member var.

    So just:
    correctPos = stream.ReceiveNext();

    Should be fine?
  • if correctPos is declared correctly as Vector3 then yes, that should normally work