# activeTerrain ?

**URL:** <https://discussions.unity.com/t/activeterrain/387427>\
**Category:** Scripting\
**Tags:** Scripting\
**Created:** [February 5, 2009, 4:52pm UTC](https://discussions.unity.com/t/activeterrain/387427 "2009-02-05T16:52:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon\_29625502](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@anon\_29625502](https://discussions.unity.com/u/anon_29625502)\
**Post date:** [February 5, 2009, 4:52pm UTC](https://discussions.unity.com/t/activeterrain/387427/1 "2009-02-05T16:52:54Z")

</div>

Hi there,

I have 2 terrain objects in the scene (it will be more), how to change activeTerrain when my character moves from one to another?

Thanks,  
Kulver

---

<div class="post-metadata">

**Author:** ![KlaRo115](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/klaro115/32/383395_2.png) [@KlaRo115](https://discussions.unity.com/u/KlaRo115)\
**Post date:** [February 5, 2009, 7:10pm UTC](https://discussions.unity.com/t/activeterrain/387427/2 "2009-02-05T19:10:14Z")

</div>

Triggers?

Try out the “Activate Trigger” code in the standard assets…

---

<div class="post-metadata">

**Author:** ![anon\_29625502](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@anon\_29625502](https://discussions.unity.com/u/anon_29625502)\
**Post date:** [February 5, 2009, 8:42pm UTC](https://discussions.unity.com/t/activeterrain/387427/3 "2009-02-05T20:42:22Z")

</div>

Well…the question is not about how to trigger some action on some condition, but about how to tell Terrain runtime object that it have to switch to new Terrain object that was loaded for example.

transform.position.y = Terrain.activeTerrain.SampleHeight(transform.position);

how to change Terrain.activeTerrain ?

Regards…

---

<div class="post-metadata">

**Author:** ![anon\_85768832](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@anon\_85768832](https://discussions.unity.com/u/anon_85768832)\
**Post date:** [February 5, 2009, 8:46pm UTC](https://discussions.unity.com/t/activeterrain/387427/4 "2009-02-05T20:46:39Z")

</div>

You can’t control which terrain is referenced by the activeTerrain property, it’s set as the first terrain that was loaded.

---

<div class="post-metadata">

**Author:** ![anon\_29625502](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@anon\_29625502](https://discussions.unity.com/u/anon_29625502)\
**Post date:** [February 5, 2009, 8:51pm UTC](https://discussions.unity.com/t/activeterrain/387427/5 "2009-02-05T20:51:12Z")

</div>

ammm…then how do you do that streaming terrain thing?  
LoadLevelAdditive all the time ?

---

<div class="post-metadata">

**Author:** ![anon\_85768832](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@anon\_85768832](https://discussions.unity.com/u/anon_85768832)\
**Post date:** [February 5, 2009, 8:56pm UTC](https://discussions.unity.com/t/activeterrain/387427/6 "2009-02-05T20:56:09Z")

</div>

Use GetComponent() to get the Terrain component attached to the particular terrain game objects you have. That way you can access each individual terrain uniquely. The activeTerrain property is just a more convenient way of doing things in those cases where you have a single terrain.

---

<div class="post-metadata">

**Author:** ![anon\_29625502](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@anon\_29625502](https://discussions.unity.com/u/anon_29625502)\
**Post date:** [February 5, 2009, 9:01pm UTC](https://discussions.unity.com/t/activeterrain/387427/7 "2009-02-05T21:01:47Z")

</div>

Ok, thank you , i’ll try now …

* * *

10 min later…  
it’s working indeed… =)  
Thanks again!

---

<div class="post-metadata">

**Author:** ![Fattie](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/fattie/32/430263_2.png) [@Fattie](https://discussions.unity.com/u/Fattie)\
**Post date:** [September 15, 2018, 2:05pm UTC](https://discussions.unity.com/t/activeterrain/387427/8 "2018-09-15T14:05:23Z")

</div>

It is … insane … that activeTerrain is just the “first one loaded” 😕
