Search Issue Tracker

By Design

Votes

0

Found in

2022.3.61f1

6000.0.51f1

6000.1.7f1

6000.2.0b4

Issue ID

UUM-108959

Regression

No

Behaviour.isActiveAndEnabled desyncs when checked from a sibling component during OnEnable/OnDisable

-

Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “Assets/Repro.unity“ Scene
3. Enter the Play Mode
4. Observe the Console window

Expected result:
When the GameObject is enabled:
“Secondary OnEnable: enabled=True activeInHierarchy=True isActiveAndEnabled=True (Should be True)” should be displayed
When the GameObject is disabled:
”Secondary OnDisable: enabled=True activeInHierarchy=False isActiveAndEnabled=False (Should be False)” should be displayed

Actual result:
When the GameObject is enabled:
“Secondary OnEnable: enabled=True activeInHierarchy=True isActiveAndEnabled=False (Should be True)” is displayed
When the GameObject is disabled:
”Secondary OnDisable: enabled=True activeInHierarchy=False isActiveAndEnabled=True (Should be False)” is displayed

Reproducible with: 2022.3.61f1, 6000.0.51f1, 6000.1.7f1, 6000.2.0b4

Reproducible on: Windows 11
Not reproducible on: No other environment tested

  1. Resolution Note:

    The check is functioning as designed. The unwanted value is returned due to Intermediate script executing before Primary or Secondary object executes OnEnable.

    This is documented in our Scripting API:
    https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Behaviour-isActiveAndEnabled.html

    In order to solve this push back Intermediate script execution in Script Execution Order menu in Project settings.

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.