mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 15:30:41 +00:00
Merge pull request #993 from AtomicWalrus/DoubleOnAddScriptFix_PR
Prevent double onAdd script call for GameBase objs
This commit is contained in:
commit
5e9c99df67
1 changed files with 9 additions and 4 deletions
|
|
@ -80,10 +80,15 @@ function spawnGameObject(%name, %addToScene)
|
|||
|
||||
function GameBaseData::onNewDataBlock(%this, %obj)
|
||||
{
|
||||
if(%this.isMethod("onRemove"))
|
||||
%this.onRemove(%obj);
|
||||
if(%this.isMethod("onAdd"))
|
||||
%this.onAdd(%obj);
|
||||
if (%obj.firstDataCheck)
|
||||
{
|
||||
if(%this.isMethod("onRemove"))
|
||||
%this.onRemove(%obj);
|
||||
if(%this.isMethod("onAdd"))
|
||||
%this.onAdd(%obj);
|
||||
}
|
||||
else
|
||||
%obj.firstDataCheck = true;
|
||||
}
|
||||
|
||||
function saveGameObject(%name, %tamlPath, %scriptPath)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue