Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Change tree seed

Discussion in 'Scripting' started by Panthesilea, Sep 9, 2013.

  1. Panthesilea

    Panthesilea

    Joined:
    May 31, 2013
    Posts:
    12
    Is there any way to change a tree's seed property in script?
     
  2. surreal4224

    surreal4224

    Joined:
    Apr 10, 2011
    Posts:
    51
  3. Panthesilea

    Panthesilea

    Joined:
    May 31, 2013
    Posts:
    12
    I didn't find any solution. I want to use tree model alone, not in terrain tool.
     
  4. Linix

    Linix

    Joined:
    Jul 14, 2012
    Posts:
    4
    I was attempting to do this.
    I can change the seed, but it doesn't update at runtime. Running out of time
    So here is as far as I got.


    void Start ()
    {
    var baseTree = GetComponent<Tree>();
    _treeController = baseTree.data as TreeEditor.TreeData;
    _root = _treeController.root as TreeEditor.TreeGroupRoot;
    _root.seed = Random.Range(0, 9999999);
    _root.UpdateSeed();

    }


    You'll see the editor change the seed, but nothing happens.
     
    groche_oniverse likes this.