Search Issue Tracker
By Design
Votes
0
Found in
2017.4.0f1
2018.2.14f1
2018.3.0a1
2019.1.0a1
Issue ID
1099664
Regression
No
In Editor, SetActive(true) does not work when it is called the first time
How to reproduce:
1. Open attached project "setActiveFalse_firstTime7.zip" and scene "FloorMap00"
2. Enter Play mode
3. In Game View, press on "Asset Tracking" button
4. Observe Console window (the image SetActive(true) was called, but it never showed up)
5. In Game View, press on "X" button
6. Repeat step 3-4 (the image shows up)
Expected result: after pressing on "Asset Tracking" button the image pops up
Actual result: the first attempt of pressing on pressing on "Asset Tracking" button the image did not show up
Reproducible with: 2017.4.16f1, 2018.3.1f1, 2019.1.0a12
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Default Scene” dropdown field contains a spelling mistake “Default Builtin”
- Editor crashes on PPtr<Mesh> after adding Text Mesh and Cloth Components to the same GameObject
- Previously deleted “DefaultLookDevProfile“ is present when upgrading the Editor version
- [Ubuntu] UI text and buttons are missing spaces in Unity Version Control > New Workspace window
- "Inherit attribute is not supported" warning is shown but attributes are available in VFX Graph Output and Update blocks
Resolution Note:
This is by design. gameObject.SetActive(false); is called in Start() of the MonoBehaviour that SetActive(true) is called on.
First time gameObject.SetActive(false), Start() will be called and then the gameObject will be disabled immediately. The second time gameObject.SetActive(false) is called, Start() has already been called and won't be called again. So SetActive(true) works the second time because gameObject.SetActive(false) isn't called afterwards.