- Home /
Trees in prefabs - in asset bundles
Just discovered Unity Trees. They seem very powerful to me. I’m creating a procedurally generated world and thought I could take a tree, put it in a prefab, put that prefab in an asset bundle, and then instantiate new trees from that asset bundle and place them in my world, at runtime. Turns out I can do all of that.
However, I noticed that when my game is running, if I drag a tree from the asset bundle directly onto the scene I get different behavior then when I instantiate that same tree via code. When I drag the tree onto the scene, while the game is running, the tree component allows me to adjust the distribution tree seed. Amazing! I can create entirely random and new trees by adjusting the slider.
When I instantiate my tree from the asset bundle, I see the tree component, but I cannot expand it, or alter it in any way.
Further, when I get an instance of the tree component using GetComponent, I cannot see a property to adjust the distribution tree seed.
The tree component seems very powerful. I would like to create a tree prefab, and then use the tree seed to create lots of random trees for my game.
Is this possible? If so, any tips on how to do this? It would be a shame to create multiple prefabs just so I could change the seed on each.
Perhaps another option would be to create the tree from scratch at runtime using components found in an asset bundle. I’ll explore that option, anyone ever done this that can lend some tips?
Your answer
![](https://koobas.hobune.stream/wayback/20220612105346im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why are the trees super dark? 4 Answers
Imported a tree but no Bend factor? 0 Answers
Making Tree Creator Trees Unique 2 Answers
Terrain system trees slightly sharpen and blur depending on camera rotation 2 Answers
Can't lightmap trees! (or Character) 1 Answer