Hi guys, I'm making a videogame just for me and my wife and I'm stuck. I wanna do the following things: 1) I wanna make a bag system similar to World of Warcraft, where in your toolbar you have 4 slots for bag and each bags have n slots. Can you link me some tutorial about how make it? 2) I wanna make a system similar to Minecraft. I don't want to build the entire world, I just want to place on a "world grid" an object on the ground, let say for example a wall or a floor. There is any tutorial for that? My version of unity is 2017 and looking for tutorial and help about how to make it. P.S. the game is in single player.
this question reads very much like "please google this for me and send me the results", which isn't usually well received. The scripting forum is meant to be more "I've ran into this specific error/issue with my code <insert code> <insert error> can someone see something I've missed?" etc.
So is my mistake. I searched a lot in the net but I didn't found anything useful. And I made my question in the wrong section.
Where should I post this question? I don't want ppl telling me the script to copy and paste, I want to see a tutorial where I can learn how to make it.
I've never played either of those games, but the first one sounds like you'd like to know how to build an inventory.. just that there are 4 of them. If you can learn about how to make one, expanding that shouldn't be too difficult. The second one just sounds like "I'd like to place an object in the world". I have to imagine that that question's been asked before. You should be able to look into those things and find some answers. Consider thinking about each task as smaller components, too. In a good tutorial, I'm sure it's covered, but for example with an inventory, you need to keep track of the items you have, display them, drag/drop, etc.. Solving each of those is much simpler, and you may be able to assemble what you seek if you think of it that way. I agree, though, it's better to use the forums to help with code/questions after you've looked into a topic.
What you need to learn is called: polymorphism My code is more Java based but it is similar in C# (the below code will be very basic and "universal") just to make you an idea. 1. Create a class called "Item" a) Inside "Item class" create a String variable called name. b) Inside "Item class" create a Integer variable called quantity. c) Inside "Item class" create a Constructor to set the data while creating a new class of this object. Code (CSharp): public class Item { int id; String name; int quantity; public Item() { this.id = -1; this.name = "nothing"; this.quantity = 0; } public Item(int idB, String nameB, int quantityB) { this.id = idB; this.name = nameB; this.quantity = quantityB; } 2. Create a class called "Bag" a) Inside "Bag class" put an array object of Item class b) create a Constructor to set the data while creating a new class of this object. Code (CSharp): public class Bag { Item[] itemsInBag; int size; int itemsCount; public Bag(int size) { this.itemsInBag = new Item[size]; this.size = items.length; this.itemsCount= 0; } public void addItem(int id, String name, int quantity) { if (itemsCount < size) { this.itemsInBag[itemsCount++] = new Item(id, name, quantity); // a code to show the item in the graphical interface in game (render the item in the "bag"). } else { //show a error message that you cant add more items in bag. } } public void removeItem(int idLookingFor) { for (int i = 0; i < size; i++) { if (this.itemsInBag[i].id == idLookingFor) { this.itemsInBag[i] = null; //a code to refresh the graphical interface in game. (to show that the item disapeared) // to show the actual items in bag is the same. return; } } //if not found then you have to show a message that you didnt found the item id. } } 3. When you create a new bag object you have to set the size of the bag and then you can add the items you like to. Code (CSharp): Bag aNewBag = new Bag(4); //creating a bag with 4 spaces. aNewBag.addItem(1, "chicken", 1); //adding an item in the bag by the id, name, quantity.