#How to change/ update prefab for object spawning in script

21 messages · Page 1 of 1 (latest)

olive spear
#

I was following the MouthCatching game tutorial posted on Lens studio community

shrewd eagle
#

You may create and configure a new scene object and set it as a prefab input. Or do you want to be able to change it in a runtime?

olive spear
#

I replaced the existing cookie into this character head but the problem is it isnt falling down it is being just spawning in the target itself

olive spear
shrewd eagle
#

hi! yes! It the mentioned guide they also add a little script to the object prefab

olive spear
#

I tried changing prefab name in the script spawning is happening but it isnt falling down

shrewd eagle
#

there should be Object Spawner script added to Object spawner Scene Object, and another script added to the Object Prefab itself. Could you please drag your Object Prefab prefab to scene, select it and screenshot? so we can see what components are there

olive spear
shrewd eagle
#

Looks like there should be an ObjectPrefab.js script here, it controls object's position

olive spear
gentle lodge
#

I don’t think the script looks like this? I remember that there were some input components in there

olive spear
shrewd eagle
olive spear
#

Perfect , It worked

#

Thank you for helping me resolve this...

#

😅 I have one more query what changes should i make in the script to make prefab go right to left

shrewd eagle
#

You may try to modify the script , there is a place where it sets the y component of a currentpos.y -= fallingSpeed * getDeltaTime(); and swap it for x! it should be relatively simple, Let us know if you have any trouble!

magic tinsel
#

Hi @shrewd eagle does the old spawner script not work with the new versions of LS? I tried using the script from LS 4 in 5 but I keep getting an error when I send it to Snapchat to preview it