Hello,
I found an incredible problem in one simple script. I made a script called MyTest, and it contains:
private var conta = 0;
function Update () {
conta++;
Debug.Log("eccomi: " + conta);
if(conta > 10) {
conta = 0;
Debug.LogWarning("Counter: " + conta);
}
}
Well, save it and assign it to any object on the screen. If you execute it, the Debug.Log will stop to write the log when conta=0 is executed!
This is the complete LOG in Unity (only the last lines
):
eccomi: 7
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Pippo:Update() (at Assets\Scripts\JavaScripts\MassiveCreek\Pippo.js:7)
(Filename: Assets/Scripts/JavaScripts/MassiveCreek/Pippo.js Line: 7)
eccomi: 8
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Pippo:Update() (at Assets\Scripts\JavaScripts\MassiveCreek\Pippo.js:7)
(Filename: Assets/Scripts/JavaScripts/MassiveCreek/Pippo.js Line: 7)
eccomi: 9
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Pippo:Update() (at Assets\Scripts\JavaScripts\MassiveCreek\Pippo.js:7)
(Filename: Assets/Scripts/JavaScripts/MassiveCreek/Pippo.js Line: 7)
eccomi: 10
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Pippo:Update() (at Assets\Scripts\JavaScripts\MassiveCreek\Pippo.js:7)
(Filename: Assets/Scripts/JavaScripts/MassiveCreek/Pippo.js Line: 7)
eccomi: 11
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Pippo:Update() (at Assets\Scripts\JavaScripts\MassiveCreek\Pippo.js:7)
(Filename: Assets/Scripts/JavaScripts/MassiveCreek/Pippo.js Line: 7)
Counter: 0
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogWarning(Object)
Pippo:Update() (at Assets\Scripts\JavaScripts\MassiveCreek\Pippo.js:11)
(Filename: Assets/Scripts/JavaScripts/MassiveCreek/Pippo.js Line: 11)
eccomi: 1
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Pippo:Update() (at Assets\Scripts\JavaScripts\MassiveCreek\Pippo.js:7)
(Filename: Assets/Scripts/JavaScripts/MassiveCreek/Pippo.js Line: 7)
Unloading 250 unused Assets to reduce memory usage. Loaded Objects now: 920.
System memory in use: 144.8 MB.
Unloading 1 Unused Serialized files (Serialized files now loaded: 2 / Dirty serialized files: 2)
If I eliminate the piece of code “conta=0” it seems it works perfectly!
Even if I use “conta = conta + 1” it works!
It seems the variable reset causes a problem!! SImply incredible!!
Have you any infor about it? Can you check it (very easy to test)!
Thank you for your help!