Hi,
I am trying to generate random “Terrain trees” at launch, then use them to populate a Terrain.
But i have this error.
Tree ‘arbreLod’ couldn’t be selected because it is not persistent.
(arbreLod = the name of a “lod gameobject” generated)
The tree are gameobject lodGroup, I can use them by instanciate by hand an set position x y z…
but i’d like to put them in the terrain system.
What is the process to achieve this ? Can anyone help me ?
(i have a "generated gameobject, with a generated mesh ", and want to put it the t.terrainData.treePrototypes)
Thanks a lot
I finally made something with
// Unity - Scripting API: PrefabUtility.SaveAsPrefabAssetAndConnect
creating a prefab at runtine.
then add this newly created prefab to the terrain.
…but question : will this work “in production” once a finale executable is built ? or it will only work here, cause i have unity editor in background; while developping
it uses the unityEidtor assembly
"
Description
The UnityEditor assembly implements the editor-specific APIs in Unity. It cannot be referenced by runtime code compiled into players.
"
–
so i doubt it’s the correct solution ? So the question remains. What is the process to implement a tree at runtime ?
(a tree used in the terrain game)