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

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

throws an semicolon error?

Comments

  • dreamora
    Options
    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)
  • legend411
    Options
    Oh gotcha, yeah it is indeed declared, as a private member var.

    So just:
    correctPos = stream.ReceiveNext();
    

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