For my game I am building a system that allows me to load assets with LibLoad().
For now Blender crashes if I toggle LibLoad() and LibFree() for a few times.
(I have no idea where in Windows the Crash reports go).
EDIT: This is what blender error log generated in Windows (I’ll check on Linux later at home):
“# Blender 2.69 (sub 0), Revision: 60995”
Not much of a help I guess.
Anyway below is the script I am using and I would like to know what I’m doing wrong
script is commented
import bge
def model(cont):
scene = bge.logic.getCurrentScene()
#When a message 'player model' is recieved,
#a loop will check the message bodies
for body in cont.sensors['Message'].bodies:
print (body)
#If message body is 'free'
if body == 'None':
#Loop through library list
for lib in bge.logic.LibList():
#If list item contains 'player'
if lib.find('player') != -1:
#Free the camera from its parent
cont.owner.removeParent()
#Free the library asset
bge.logic.LibFree(lib)
#Set the globaldictionary variable to None
bge.logic.globalDict['Player info']['Model'] = None
#If message body is 'gm'
elif body == 'gm':
#Load a model defined in message
bge.logic.LibLoad('//assets/models/player/'+body+'.blend', 'Scene', load_actions = True, async = False)
#Set the globaldictionary variable to 'gm'
bge.logic.globalDict['Player info']['Model'] = body
EDIT: Argh Sorry I posted on wrong section, cold someone move this post?