At 3:28 I should have put the break inside the if statement :p woops! Went back to fix it and still did it wrong! So IF we instantiate, we break out of the loop. You add this break if you want your enemy to only drop one item. Grab all the required source files here! www.patreon.com/posts/enemy-loot-2d-17-94207787
actually if u dont mind, i have a problem with the isholding, and thats if i press hold and move to the other scene with that, the isholding keeps being true, and thats why i keep going back and back hahah, i have tried putting isholding false in the start, or even in the onsceneload, i also tried to put 2 scripts with different variables but same logic but i havent fixed it yet :"
sorry is error Can you help me please Error CS0120 An object reference is required for the non-static field, method, or property 'LootItem.itemPrefab'and What should I do?
Make sure your itemPrefab slot has a prefab inside it - you'll see in the video we drag a prefab in to the empty slot! You'll see it in unity under your LootItem :-)
You can make a prefab by dragging a gameobject from the hierarchy to your assets folder, then you can drag it from your assets to the empty itemPrefab slot.
A fun idea!! Perhaps we can use our gems collected on each level with a chance to spawn the shop, then spend gems to guy an extra max heart container 🤔 I’ll be doing a series on rpgs next so will definitely have a shop there!!
@@GameCodeLibrary but i have a probleme whenever i colide from left or right i colect the amount 1 but if i colect from the top it add 2 and sometime 3 do u know why? Im using your coin counter from one of ur old video.
@noobdev6464 could be because we disabled the coin in the previous coin video, but in this one we destroy the whole game object! Perhaps try replacing the disabling with destroying
At 3:28 I should have put the break inside the if statement :p woops! Went back to fix it and still did it wrong!
So IF we instantiate, we break out of the loop.
You add this break if you want your enemy to only drop one item.
Grab all the required source files here!
www.patreon.com/posts/enemy-loot-2d-17-94207787
Cant express how helpful this video is.
So happy to help!! :-)
Great tutorial, this code helped me a lot, thank you very much.
I'm glad I could help!!! :-)
Thanks for this tutorial !
You’re welcome I’m glad you liked it! :-)
actually if u dont mind, i have a problem with the isholding, and thats if i press hold and move to the other scene with that, the isholding keeps being true, and thats why i keep going back and back hahah, i have tried putting isholding false in the start, or even in the onsceneload, i also tried to put 2 scripts with different variables but same logic but i havent fixed it yet :"
sorry is error
Can you help me please
Error CS0120 An object reference is required for the non-static field, method, or property 'LootItem.itemPrefab'and
What should I do?
Make sure your itemPrefab slot has a prefab inside it - you'll see in the video we drag a prefab in to the empty slot!
You'll see it in unity under your LootItem :-)
You can make a prefab by dragging a gameobject from the hierarchy to your assets folder, then you can drag it from your assets to the empty itemPrefab slot.
@@GameCodeLibrary Thanks
Nice and easy video. it will be nice to be able to buy items from a store in the map juste like hollow knight?
A fun idea!! Perhaps we can use our gems collected on each level with a chance to spawn the shop, then spend gems to guy an extra max heart container 🤔
I’ll be doing a series on rpgs next so will definitely have a shop there!!
@@GameCodeLibrary nice cant wait,
@@GameCodeLibrary but i have a probleme whenever i colide from left or right i colect the amount 1 but if i colect from the top it add 2 and sometime 3 do u know why? Im using your coin counter from one of ur old video.
@noobdev6464 could be because we disabled the coin in the previous coin video, but in this one we destroy the whole game object! Perhaps try replacing the disabling with destroying
LEZGOOO
Ty for the hype as always 🥰🙏