Hey guys,
Im new to game develpment and unity and c#, ive done basic tutorials etc and now im trying to create my first game.
Im making a coin pusher game, and my 1st platform is a moving one which ive created a script for to make the coins stick to the platform. (All coins are children to the parent ive name “Tokens”). So far this works perfectly and all coins collide with echother like normal physics.
Now on the 2nd platform down ive created a script to make the coins detach from the moving platform. But to do this i had to create a variable in the script, so in the inspection window i had to drag either the “Tokens” (empty object parent) into the slot which meant as soon as one coin dropped, all coins stopped moving, or if i put a single child coin into the slot, then that specific one coin only stops moving but any other coins will keep moving even if they have dropped onto the 2nd platform.
I will also add that after creating my 1st coin i duplicated it to make the rest.
Hope thats enough info, please help
Thanks.
Each coin should have the same script. Stick with one coin and test the script and when it’s working make this coin a prefab.
Then in your inspector or main script use this prefab.
To change parent of an object use: obj.transform.parent = null; or whatever parent with transform you want.
Thanks heaps mate for your help, i did exactly that eventually and it worked haha. Cheers.