I am trying to set the tilesource (as in, replace the whole texture) to an image determined at runtime (the image dimensions are the same as the compiled tilesource).
i tried following along Changing texture for a tilesource at runtime to determine the location of the texture, but there’s not too much that was shown in that thread
here is the code i am running:
function settilemaptexture(texturedata)
resource.set_texture("/main/tiles.t.texturesetc", texturedata.header, texturedata.buffer)
end
<different file>
newtiledata=loaddata("testtextures/tiles.png") --this just reads data from a file relative to the script folder.
if newtiledata then
imgres=imageloader.load{data=newtiledata}
if imgres then
settilemaptexture(imgres)
end
end
currently, what i am doing crashes the engine
ERROR:CRASH: CALL STACK:
ERROR:CRASH: 0 0x7FF78206D3A0 dmCrash::GenerateCallstack D:\a\defold\defold\engine\crash\src\backtrace_win32.cpp:144
ERROR:CRASH: 1 0x7FF78242B838 raise /tmp/job8834229921072479505/minkernel/crts/ucrt/src/appcrt/misc/signal.cpp:547
ERROR:CRASH: 2 0x7FF78241BDC0 abort /tmp/job8834229921072479505/minkernel/crts/ucrt/src/appcrt/startup/abort.cpp:71
ERROR:CRASH: 3 0x7FF78241B0A4 common_assert_to_stderr<wchar_t> /tmp/job8834229921072479505/minkernel/crts/ucrt/src/appcrt/startup/assert.cpp:186
ERROR:CRASH: 4 0x7FF78241ABBC _wassert /tmp/job8834229921072479505/minkernel/crts/ucrt/src/appcrt/startup/assert.cpp:443
ERROR:CRASH: 5 0x7FF7820BFDF0 dmDDF::LoadMessage D:\a\defold\defold\engine\ddf\src\ddf\ddf.cpp:164
ERROR:CRASH: 6 0x7FF7820BFDD0 dmDDF::LoadMessage D:\a\defold\defold\engine\ddf\src\ddf\ddf.cpp:158
ERROR:CRASH: 7 0x7FF7821D1DD0 dmGameSystem::ResTextureSetRecreate D:\a\defold\defold\engine\gamesys\src\gamesys\resources\res_textureset.cpp:184
ERROR:CRASH: 8 0x7FF7820AD660 dmResource::SetResource D:\a\defold\defold\engine\resource\src\resource.cpp:1097
ERROR:CRASH: 9 0x7FF7821FC450 dmGameSystem::SetTexture D:\a\defold\defold\engine\gamesys\src\gamesys\scripts\script_resource.cpp:1493
ERROR:CRASH: 10 0x7FF781FE790E lj_BC_FUNCC <unknown>:0
ERROR:CRASH: 11 0x7FF7820648D0 lua_pcall <unknown>:0
ERROR:CRASH: 12 0x7FF7820968A0 dmScript::PCallInternal D:\a\defold\defold\engine\script\src\script.cpp:1401
ERROR:CRASH: 13 0x7FF7820FC690 dmGameObject::RunScript D:\a\defold\defold\engine\gameobject\src\gameobject\comp_script.cpp:142
ERROR:CRASH: 14 0x7FF7820FAF30 dmGameObject::CompScriptInit D:\a\defold\defold\engine\gameobject\src\gameobject\comp_script.cpp:183
ERROR:CRASH: 15 0x7FF7820CDA30 dmGameObject::InitComponents D:\a\defold\defold\engine\gameobject\src\gameobject\gameobject.cpp:1700
ERROR:CRASH: 16 0x7FF7820CA290 dmGameObject::InitCollection D:\a\defold\defold\engine\gameobject\src\gameobject\gameobject.cpp:1769
ERROR:CRASH: 17 0x7FF782150080 dmEngine::Init D:\a\defold\defold\engine\engine\src\engine.cpp:1340
ERROR:CRASH: 18 0x7FF78214EFC0 dmEngineCreate D:\a\defold\defold\engine\engine\src\engine.cpp:2152
ERROR:CRASH: 19 0x7FF782154CD0 dmEngine::RunLoop D:\a\defold\defold\engine\engine\src\engine_loop.cpp:68
ERROR:CRASH: 20 0x7FF78205ACB0 engine_main D:\a\defold\defold\engine\engine\src\engine_main.cpp:152
ERROR:CRASH: 21 0x7FF7823D44C4 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
ERROR:CRASH: 22 0x7FF80D047330 BaseThreadInitThunk <unknown>:0
ERROR:CRASH: 23 0x7FF80DBE2690 RtlUserThreadStart <unknown>:0
i’m not really sure what to do here