Комментарии:
For those wanting to do a 3D object instead of a Sprite, it's SUPER easy:
Delete the two references to the sprite (the public variable in Loot, and the lootGameObject...sprite = droppedItem.lootSprite in LootBag).
Create the item you want dropped in the world as you normally would. So drag a 3D cube to the screen if you want to drop a cube. Fix it up however you'd like and create a prefab out of it (i.e. Drag it into a folder in your assets)
Whatever Object has the Loot Bag Script attached to it, change the Dropped Item Prefab to that new prefab you just made (so don't use LootPrefab, it was just an example item).
And that's it! Since nothing is referencing a sprite, it'll just drop the whole object.
If you want to do this in a 3d game, like me that I'm currently doing an rpg, all you have to do is change the sprite variable in Loot for GameObject
Ответитьmy items dont stop moving, why?
ОтветитьVery Helpfull and good Tutorial!!! Thanks a lot! It is exact what i needed
ОтветитьI really love your code but I stuck on drop more than one item like one enemy died is drop 2 gold ore and one gold bar can u please help me to make it or explain me to do it Thank again for your wonderful code. :)
ОтветитьI've watched several of your videos.
This is the one that got me to subscribe. Thank you for this. Simple, effective and easily modifiable.
trying to integrate this into Coding With Unity's inventory system tutorial but having a really hard time
ОтветитьLike always. not working in my engine xD even GPT says code is writed good. but when i have other system like items, inventory, equipment, then something must go wrong ;/ ehh
Ответитьthe problem of this system is that this doesn't show real chances, like if there 70% rare item and 100% rare item, it would turns out, that 70% will pop up more times then 100%
Ответитьthe problem of this system is that this doesn't show real chances, like if there 70% rare item and 100% rare item, it would turns out, that 70% will pop up more times then 100%
ОтветитьThis video was just another regurgitated remake of other vids. So missleading.
Ответитьis there a way that instead of using sprites use a gameobject?
Ответитьthanks. easy, simple, complete and concise.
ОтветитьThe only thing I found missing is putting items in a pool, just in case you have lots off loot on the screen, add a switch, then you can easily use this in your other projects
ОтветитьPog
ОтветитьHow do you write a function to retrieve loot items?
ОтветитьHey I have been enjoying your tutorials. I'm curious if you plan on returning?
ОтветитьI have this class in my lootPrefab, how can I access the name of the item there? I need somehow to access the lootName value
public class Colectable : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log(gameObject.GetComponent<Loot>().lootName);
if(collision.tag == "Player")
{
Player player = collision.GetComponent<Player>();
if(gameObject.GetComponent<Loot>().lootName == "Coin")
{
player.coins += 1;
}
if(gameObject.GetComponent<Loot>().lootName == "Experience")
{
player.experience += 1;
}
Destroy(gameObject);
}
}
}
Thank you
ОтветитьHello I have a question: Is it safe to use public for lootList? Can't it modified by a player?
ОтветитьEpic Video, Just found your channel, trying to figure out some stuff, magically it appeared. Great Content!!!! Hope your channel grows
ОтветитьCan i use this for a 3d game?
ОтветитьVery nice!
And now I'm gonna steal it.
Thank you!
how can works for 3d objects?
Ответитьhow can I adapt this for 3D?
ОтветитьI checked that the code is running well.
By the way, how can I modify the code to randomly drop prefabs instead of sprite files?
First thing first bro thanks for the vid but i have a question.when i drag my sprites the list not accepting it can you help me please?
ОтветитьHey man im loving theses tutorials. I have one question in the how to get an enemy to chase you in unity tutorial i have an issue with the public static event Action<Enemy>OnEnemyKilled; code it pops up an error saying Assets\Enemy.cs(7,25): error CS0246: The type or namespace name 'Action<>' could not be found (are you missing a using directive or an assembly reference?) im pretty new to all of this and i have no idea how to fix this. i cant progress threw the tutorials becasue im stuck ont this part. However theses are awesome and simple thank you! keep it up
ОтветитьFantastic video. I saw a few comments below asking how to differentiate the items since they all drop from the same prefab. For example in my game I want the items to have a different effects when the player picks them up. I added this line of code to your script under the InstantiateLoot function in the LootBag script to add a tag to the prefab depending on what the lootName is. From there you can just add an onCollision function in the player script to react to the tagged item. Hope this helps
public void InstantiateLoot(Vector3 spawnPosition)
{
Loot droppedItem = GetDroppedItem();
if(droppedItem != null)
{
GameObject lootGameObject = Instantiate(droppedItemPrefab, spawnPosition, Quaternion.identity);
lootGameObject.GetComponent<SpriteRenderer>().sprite = droppedItem.lootSprite;
//assign tag function
if(droppedItem.lootName is "Shield")
{
lootGameObject.tag = "Shield";
}
}
}
We need more videos!
ОтветитьHey man. I just found your channel and I love you tutorial style. Very helpful!
Ответитьhey bmo how can i pick up the items that dropped like an ammo box
ОтветитьIm so lucky that i picked up Unity again after years during the time u have started uploading content mate
ОтветитьUnderrated channel! Keep up the excellent content
Ответитьhey I was just wondering how to differentiate the items from each other, since they all come from 1 prefab
ОтветитьThank you Sir
Can you make a video how to make a Quest system ?
Great lassen i love und top down shooter tuts .❤
Can u please do next time how to make a high score or Player health or a enemy spawner
At this point there are options.
At this point there is one option.
Please correct your speech.
You're going to encourage bad habits for your audience.
Hey BMo! Is there a chance to get a tutorial on Quick Time Events in Unity, please?
ОтветитьHey!
Can you make Tutorial on Monopoly/Businessman Board Game in Unity 2D ?
Soo useful, I will definitely going to use this for my next school proyect, thank you so much and keep up your amazing videos. Really helps me and other beginners a lot.
ОтветитьHey, your tutorials are amazing and you deserve millions of subs.... Loving watching and learning from you so far!!
ОтветитьAwesome video! I had a question on using this for 3D game objects. Instead of using "GetComponent<SpriteRenderer>().sprite" could I use GetComponent<MeshRenderer>()? Not sure what the equivalent would be when working in 3D. Thank you for your excellent content!
ОтветитьTy I got my first divine because of you
ОтветитьAs always, everything is super. Waiting for new cheats from your side
ОтветитьHey BMo! So I'm trying to figure out a way to return the dropped item, while keeping the ability to drop multiple items at the same time? Help would be appreciated, love the video so far!
ОтветитьYou, sir, have earned my sub and like.
ОтветитьGIVE ME ALL YOUR LOOT
ОтветитьGreat lesson here. Very clearly shows the fundamental to getting an RNG loot system in place.
Ответитьi would love a tutorial for an shop system like enter the gungeon or neon abyss
Ответить