Brackeys scriptable objects1/19/2024 It might take days or weeks to work through a single 5-minute tutorial. This is the part that takes a LOT of time when you are new. Go back to the tutorial and try to figure out WHY they did that. Read the documentation on the functions involved. If you are unable to explain any part of it, STOP. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. Go back and work through every part of the tutorial again, and this time explain it to your doggie. It is almost CERTAINLY your typo causing the error, so look again and fix it. Your error will probably be somewhere near the parenthesis numbers (line and character position) in the file. Do NOT continue until you fix your error. If you get any errors, learn how to read the error code and fix your error. Every step must be taken, every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly, literally NOTHING can be omitted or skipped.įortunately this is the easiest part to get right: Be a robot. Even the slightest deviation (even a single character!) generally ends in disaster. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. How to do tutorials properly, two (2) simple steps to success: Tutorials and example code are great, but keep this in mind to maximize your success and minimize your frustration: Try some tutorials and learn from them to bring your design to life. Part of the task will be basic data preparation and processing in collections and part of it will be interoperating with Unity prefabs to visualize it.Įverything else is details you need to decide based on your design. this is all EXTREMELY well-covered by tutorials. All of the examples I've seen, use the same sprite for the card backs and they create the deck by dragging unity objects into the fields by hand, one-at-a-time.ĭon't start in a vacuum. Sorry, I don't have more code to show because I can't figure out how to do this, so I literally have nothing to show. > How do I "add" (instantiate) that newly populated card to the "cardDeck" List? So, if I create a temporary instance of a card class and populate the all of the values like shown above, Then I have logic that's beyond the scope of this discussion, that figures out which sprites to put on the back and front (by their filename), and other fields of each card, like this:ĬardFace = Resources.Load("Images/Front Green") as Sprite ĬardBack = Resources.Load("Images/Back GPY") as Sprite ![]() Public static List cardDeck = new List() Then we can create another script to builds the deck, which has some code this. to create an instance of the scriptable object The card class could also be a scriptable object, something like this: (now referred to as CardSO) Not a single one of these show how to do what I’d like to do. I’ve loaded many C# / Unity card game projects from GitHub, watched countless youtube videos, read unity game books and watched online courses. ![]() I have searched and searched for a way to do this, but I can’t seem to find a solution. You can see that this method requires far less space to only have about 25 front/back sprites (for now) and not hundreds of statically created cards of these combinations, which is tedious, time consuming and prone to error. json) or just simple C# code logic to create the deck to be used in the game. I’d like to instantiate a list AT RUN TIME from a data source (i.e. I don’t want to statically pre-store all of the many, many combinations of front and back sprites. The player chooses an action based on the back sprite’s capability and the result of the action depends on the front sprite’s capability. …and so on.ĭuring play, these images are used in combination with each other on the same card and represent 2 actions by the player. Another card with a back “A” can have a front with sprite “Y”, or “Z". So a card with a back with a sprite called “A” can have a front with sprite “X”. ![]() ![]() There will be about 15 or so of types of back sprites and about 10 or so types of front sprites. The cards WILL NOT all have the same back. The fronts and backs may be a more compound images in the future, made from multiple sprites or other images, but let’s start with a single sprite on each side. The cards will initially be created with a sprite on the front and a sprite on the back.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |