Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to detect change in unity files ?

Discussion in 'Scripting' started by Potato_Lord913, Mar 17, 2019.

  1. Potato_Lord913

    Potato_Lord913

    Joined:
    Dec 3, 2017
    Posts:
    2
    I wrote a script that reads a terrains and generates a mesh based on it. (video on that soon)
    It works fine but the generation happens at the click of a button
    I want it to dynamically happen when the terrain is edited

    terrain data is stored in it's terrain_data file
    is there a way to detect change in such file in unity
    maybe a hook on every set access to the file

    Thanks in advance.
     
  2. Luxgile

    Luxgile

    Joined:
    Nov 27, 2016
    Posts:
    16
    You can use this with a reference to the terrain_data and, if it changed just update the mesh. This should be done only in editor scripts and i've only used it while i was changing something from that editor, don't know if it works with other components but you can give it a try