Search Issue Tracker
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
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.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [OSX][Settings] When using only the new ISX as Input Handling, mouse position and scroll are still detected by the old system.
- [Scripting] Input Action fails to re-enable after disabled.
- [MacOS] "Bloom" does not work in Standalone Build
- Mesh.CombineMeshes result has different normals if the original mesh has tweaked normals and scale
- [Hub] In licence error screen https://unity3d.com/unity/err/license redirects to not found website