Can blender get Object from name in realtime script?


(Yamyam) #1

I want to manage game objects with the List. first, I’ve use refference of game class objects, but the List can’t use with game class object!

I think Blender realtime python script can’t use the List for not strings(int, float, and Classes). It seems, Blender converts not string class to string class in gamemode…

Does anyone knows how to solve this?

thank you.


(saluk) #2

You can use pickle to turn a class into a string and back again for saving in objects. It requires python to be installed however. If you just want to save a simple list (without any odd classes inside the list) you can use str(list) to make it a string and eval(string) to turn it back into a list. This does NOT require an install of python.

I used it extensively in my save load script (shameless plug:)


(Yamyam) #3

Thank you quick reply (and sorry for slow my reply).

I’ll try these way. Thank you again!:slight_smile: