Search Issue Tracker

By Design

Votes

0

Found in

2017.1.0b8

Issue ID

920425

Regression

Yes

Warning appears when changing MeshFilter.sharedMesh during OnValidate()

Editor - Other

-

Reproduction steps:
1. Open project attached (TerrainEngine.zip).
2. Open scene "testscene".
3. Select object "Terrain".
4. Change UTerrain script parameters, for example size.

Expected result: Once size is changed OnValidate function will work fine.
Actual result: Error appears: "SendMessage cannot be called during Awake, CheckConsistency, or OnValidate"

Note: There is a code that is called during OnValidate:
Mesh terrainMesh = new Mesh();
meshFilter.sharedMesh = terrainMesh;

Reproduced on: 2017.1.0a2, 2017.1.0b9, 2017.2.0a3.
Works fine on: 5.5.0f3, 5.6.1f1, 5.6.1p4.
Regression introduced in 2017.1.

Comments (7)

  1. 0e062412afdccab86f804a749df3f4ff?d=mm

    sravani-sga

    Aug 01, 2018 10:22

    Works without any problem with Unity 5.6.X
    Warning with 2017.4.5f1

    When this issue will get resolved
    Will this effect the performance of game?

  2. F9ca493230829b7e4276ae232b9214b2?d=mm

    Juicy-Beast

    May 09, 2018 14:39

    "By Design" the error message is misleading

  3. 41cd443e42fb978f4da36b0498b729fb?d=mm

    clckwrk

    Jan 08, 2018 21:27

    Why is this "By Design"?

    The warning message has nothing to do with what is causing it. If this really is caused by editing sharedMesh, then the wording of the warning should reflect that.

  4. 47a01e2c7476639108c25b3084abce74?d=mm

    stephero

    Sep 12, 2017 06:41

    Same problem if I try to change Layer from OnValidate:
    void OnValidate () { gameObject.layer = LayerMask.NameToLayer("Water"); }

    Works without any problem with Unity 5.6.X
    Warning with 2017.1.0f3 and 2017.1.1f1

  5. B797449429747ef4341b4939a00b2ce8?d=mm

    Flavelius

    Aug 31, 2017 09:39

    I just encountered this. Why is it by design, when SendMessage is not even used (in code)?

  6. 3f57a21554d793f7bcdc7939e73baa8b?d=mm

    GDesmoulins

    Aug 18, 2017 09:26

    Same problem for me for a simple SetActive on a child (always on a "OnValidate" command)

  7. 97405f881dc6ec629d1b40ddc54b51e7?d=mm

    Kiyoshi-Fujita

    Jul 16, 2017 04:39

    Just by the user operating the Inspector, just creating a new game object with a script from the OnValidate () call will produce a yellow error.

    SendMessage cannot be called during Awake, CheckConsistency, or OnValidate

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.