my gadget unsyced code does not seem to run at all. I have tried many different functions in the unsynced portion, such as:
function gadget:Update()
function gadget:Initialize()
I can not even get the below posted example to run the unsynced portion.
if (gadgetHandler:IsSyncedCode()) then
--SYNCED CODE
local number = 10 -- declaring local variable 'number'
function gadget:SomeSyncedCallin(...)
number=number+1 -- increment variable's value by one
_G.number=number -- save the new value into a global variable
end
else
--UNSYNCED CODE
function gadget:SomeUnsyncedCallin(...)
Spring.Echo(SYNCED.number) -- print the global variable's value on screen
end
end
Is there a special way to register the unsynced functions?
Gadget Unsynced functions
Moderator: Moderators
Re: Gadget Unsynced functions
Does your game have a LuaRules/draw.lua which includes the gadgethandler?
Re: Gadget Unsynced functions
Some callins do not get called in unsynced.super_g wrote: --UNSYNCED CODE
function gadget:SomeUnsyncedCallin(...)
eg function gadget:GameFrame (f)
http://answers.springlobby.info/questio ... d-luarules
http://answers.springlobby.info/questio ... ced-gadget
Re: Gadget Unsynced functions
Update and Initialize are certainly called in unsynced; I suspect this is the issue:
http://answers.springlobby.info/questio ... nitialized
http://answers.springlobby.info/questio ... nitialized
Re: Gadget Unsynced functions
THANK YOU!
I'm currently working with Super_G on this project, and this solved the issue beautifully. We were missing draw.lua
I'm currently working with Super_G on this project, and this solved the issue beautifully. We were missing draw.lua