Mostly Harmless
Legacy talk:TriggeredTexture
From Unreal Wiki, The Unreal Engine Documentation Site
ScriptWarning if 10 textures used[edit]
Recently I noticed a ScriptWarning:
ScriptWarning: TriggeredTexture MH-TwinTower(SB)-Rev2.TriggeredTexture1 (Function Botpack.TriggeredTexture.Trigger:0046) Accessed array out of bounds (10/10)
I had a look at the code and found the problem:
var() Texture Textures[10]; ... event Trigger( Actor Other, Pawn EventInstigator ) { if( bTriggerOnceOnly && (Textures[CurrentTexture + 1] == None || CurrentTexture == 9) ) return; CurrentTexture++; if( Textures[CurrentTexture] == None || CurrentTexture == 10 ) CurrentTexture = 0; }
If 10 textures are used and the last texture has been choosen, CurrentTexture has the value of 9. With the next function call CurrentTexture will be increased to 10 ("CurrentTexture++") and then the condition
Textures[CurrentTexture] == None
is evaluated. At this moment, the array is accessed at index 10, which does not exist.
--SeriousBarbie 05:01, 5 April 2015 (UTC)
- Reported on GitHub. --SeriousBarbie 12:38, 2 December 2021 (MET)