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. Dismiss Notice

Question How to give a TreeInstance an ID of some sort to later identify it?

Discussion in 'Scripting' started by Shreddedcoconut, Nov 15, 2021.

  1. Shreddedcoconut

    Shreddedcoconut

    Joined:
    Jul 30, 2021
    Posts:
    61
    Hello,

    I'm adding
    TreeInstances
    to my terrain. I can access each and every one of them by using
    terrain.terrainData.treeInstances

    ..but I want to be able to tell certain trees apart from others, e.g. I can tell which trees were added by my script, and which were added by some other method. I thought of giving each
    TreeInstance
    an ID that I can check, but that idea quickly faded because the
    TreeInstance
    class doesn't have the property ID or anything like it, as far as I know.

    Any help is appreciated!
     
  2. Shreddedcoconut

    Shreddedcoconut

    Joined:
    Jul 30, 2021
    Posts:
    61