Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Invalid expression term '<'

Discussion in 'Getting Started' started by Lojtra12, Sep 4, 2019.

  1. Lojtra12

    Lojtra12

    Joined:
    May 4, 2017
    Posts:
    80
    I am trying to make plane detection, and in code it says this:
    Assets\HelloAR\Scripts\ARController.cs(34,25): error CS1525: Invalid expression term '<'

    // Instantiate a Grid for each DetectedPlane in m_NewDetectedPlanes
    for (int i = 0; < m_NewDetectedPlanes.Count; ++i)

    See photo attached … what could be wrong with it, thanks
     

    Attached Files:

  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Well, it's nonsensical syntax as it is. The middle term of your for loop needs to be a Boolean expression, but
    <
    is a boolean operator; it can't start an expression. Probably you meant
    i < m_NewDetectedPlanes.Count
    .
     
  3. Lojtra12

    Lojtra12

    Joined:
    May 4, 2017
    Posts:
    80
    oh, yes of course, I just did not see that :) thank you
     
    JoeStrout likes this.