Hi, I am doing this tutorial : http://www.youtube.com/watch?v=cklrL9LD3XI&lc=hsGrEBKxn9B7FIAK5W00ut2hdpd5ba5j807TxKOb_bk
Blender Game Engine Started
[Spawner, VBlock, HBlock, Camera, Tunnel, default__cam]
Spawn:: HBlock
Python script error - object ‘Spawner’, controller ‘Python’:
Traceback (most recent call last):
File “/home/case/laptop3D/blendergametut/tunnel1.blend/SpawnScript.py”, line 18, in spawn
ValueError: scene.addObject(object, other, time): KX_Scene (first argument): object must be in an inactive layer
and I’m getting this error KX_Scene (first argument): object must be in an inactive layer, I’ve tried varies different ways to reference to the HBlock / VBlock and nothing seems to be working, everything in my file is all on the first layer, so I dont know what it is talking about.
from bge import logic
import random
def spawn():
scene = logic.getCurrentScene()
print(scene.objects)
blocks = (scene.objects["VBlock"], scene.objects["HBlock"])
block = random.choice(blocks)
print("Spawn::" ,block)
new_block = scene.addObject(block, scene.objects["Spawner"])
new_block.setLinearVelocity([0, 180, 0])