beo6 Posted July 26, 2015 Share Posted July 26, 2015 (edited) When i use local building = Prefab:Load("Prefabs/Buildings/"..pfbfile) in my script, the Start function is not called and trying to call it manually with building.script:Start() ends with an exception. If i place it in the Map with the editor, the placed entity calls its start script, however GetKeyValue("name") returns nothing. When the Prefab is placed with the editor and i load another prefab with the script the loaded prefab calls its Start function and returns the correct GetKeyValue("name") This issue might be related: http://www.leadwerks.com/werkspace/topic/13048-foreachentityinaabbdo-to-find-entities/ //Edited thread title as there is even a small bug when placing it with the editor. Edited July 26, 2015 by beo6 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted August 4, 2015 Share Posted August 4, 2015 Please see the guidelines for filing bug reports: http://www.leadwerks.com/werkspace/topic/6125-guidelines-for-bug-reports/ Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
beo6 Posted August 5, 2015 Author Share Posted August 5, 2015 Yes. i know that Thread, i thought it is obvious what the issue is. Sorry about that. Have now created a project where i reproduced the issues. Hope that helps to fix them. https://cloud.software-sl.de/index.php/s/TjuqtGZ3gyWorUC Press the Space key to call the Prefab:Load function. the loading script part is in the gamecontroller.lua script. There are two maps. "callingStartFunctionButEditorPlacedDoesNotReturnName.map" Where the prefab is already placed in the editor. There the prefab that was placed with the editor does not return the Name but the Start function is called. The by script loaded prefabs do return the name and Start is called. "notCallingStartFunctions.map" this one is without a placed prefab in the map. There the loaded prefabs do never call Start. It seems that the Start function is not called when the first load has Prefab.NoStartCall as parameter. Then the prefabs loaded after that do still not call the Start Script even if that parameter is missing or i explicitly set the parameter Map.LoadScripts 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted August 6, 2015 Share Posted August 6, 2015 Thanks for the files. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted August 19, 2015 Share Posted August 19, 2015 Okay, you just need to have Map.LoadScripts in your flags when the first Prefab::Load() command is called. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
beo6 Posted August 21, 2015 Author Share Posted August 21, 2015 (edited) Thanks. Using Prefab:Load("Prefabs/myprefab.pfb", Map.LoadScripts+Prefab.NoStartCall) seems to work. But it feels a bit odd since calling only Prefab:Load("Prefabs/myprefab.pfb") for the first time does load the script. So it is not really clear that Prefab.NoStartCall does completely prevent loading the script and not only just prevents calling the Start function. //Edit: what about that prefabs placed by the editor do not return their entity name with self.entity:GetKeyValue("name") ? Edited August 21, 2015 by beo6 Quote Link to comment Share on other sites More sharing options...
Josh Posted August 21, 2015 Share Posted August 21, 2015 The default parameter is the LoadScripts flag, so if you don't supply anything that is filled in: http://www.leadwerks.com/werkspace/page/api-reference/_/prefab/prefabload-r622 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
beo6 Posted August 21, 2015 Author Share Posted August 21, 2015 ok. thanks now it makes sence. still GetKeyValue issue on Editor-placed prefabs.. Quote Link to comment Share on other sites More sharing options...
Rick Posted September 7, 2015 Share Posted September 7, 2015 I think I'm seeing this prefab and GetKeyValue() issue too. 1 Quote Link to comment Share on other sites More sharing options...
DooMAGE Posted July 24, 2016 Share Posted July 24, 2016 Anyone with this issue too? Quote My Leadwerks games! https://ragingmages.itch.io/ Link to comment Share on other sites More sharing options...
Genebris Posted July 24, 2016 Share Posted July 24, 2016 Everyone has it. Quote Link to comment Share on other sites More sharing options...
DooMAGE Posted July 24, 2016 Share Posted July 24, 2016 I guess josh is not aware of the issue. Quote My Leadwerks games! https://ragingmages.itch.io/ Link to comment Share on other sites More sharing options...
beo6 Posted August 9, 2016 Author Share Posted August 9, 2016 i haven't tried it again if the issue is fixed, but if it is not, too bad Josh is ignoring my posts. Maybe someone needs to post the issue again in a new thread. Quote Link to comment Share on other sites More sharing options...
Josh Posted August 12, 2016 Share Posted August 12, 2016 If you post a bug report with an example map that demonstrates a problem I will be happy to take a look. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.