Search Unity

Terrain SampleHeight is returning two values

Discussion in 'World Building' started by Ben_Iyan, May 16, 2018.

  1. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    I sample the terrain height once per update, and log the result. Instead of getting one value, however, I get two: the terrain's max height and the actual height at my transform.position. I'm not sure how this is even possible; so I added an "iteration" variable and increment it every time I sample the terrain height. Sure enough, I get two values at iteration 0, and so on. Can anyone explain what's going on? How can I get two log outputs from one Debug.Log? Thanks.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,435
    maybe the script is attached twice somewhere?
     
    Ben_Iyan likes this.
  3. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    OMG... I think I just redefined the term "dummy". That was exactly the problem (a vehicle that I had "hidden" in some trees to test visibility, and I forgot about it). Thank you so much.