Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question How to make my own OnValidate()

Discussion in 'Editor & General Support' started by DmytroSerebrennikov, Feb 28, 2024.

  1. DmytroSerebrennikov

    DmytroSerebrennikov

    Joined:
    May 28, 2022
    Posts:
    16
    OnValidate() when calling GetComponentInParent throws an error.
    In general, I guess the error may be due to the fact that objects are loaded at different times and therefore randomly causes an error. And so I have the following question:

    How to make my own OnValidate(), it should be called only after saving the changes to the current class (or assembly). Please tell any ideas (it must be not-static method). Thanks
     
    Last edited: Feb 29, 2024
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,795
    DmytroSerebrennikov likes this.