You can use ScriptableObject.CreateInstance to get unique temporary runtime instances of the scriptable object, and then you modify those. So, in your case, you want to have many unique instances of a scriptableobject, so that you can modify them independently with code, and you don't want to modify the original scriptableobject, with code, rather you just want to treat the original like it's a prefab that you can instantiate gameobjects from, or a C# class that you can create instances of. To make things more confusing, when someone plays your game outside of the editor, changes made to the scriptable object via code don't persist after they have closed the game. Those changes will persist after you have stopped playmode, and closed the editor. Typically if you are using them for gameplay, you don't modify that scriptableobject reference at runtime, because modifying them via code in playmode in the editor will modify them forever. It's a great way to share data with a bunch of different things, they are all accessing one thing. Read the comments on the video: did anyone have issues like you did? If there's an error, you will NEVER be the first guy to find it.īeyond that, Step 3, 4, 5 and 6 become easy because you already understand!Ĭlick to expand.A scriptable object is a single instance, which is one of its selling points. For some other less-well-known content creators, this is less true. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. Of course, all this presupposes no errors in the tutorial. If you want to learn, you MUST do Step 2. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost. Step 2 is the part everybody seems to miss. 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: This is why I asked if I'm just missing something/scripting them the wrong way. From what I've tested around scriptable objects, it's hard/not possible to just activate 1 at a time, it instead activates all of them. I'm wanting to scale that up for multiple objects in the scene, but only 1 object activating at once. I have 1 object, at a random time it'll activate which will turn it invisible, and after an input from the user it'll deactivate and turn visable again. I have it all working with 1 object, using scriptable objects, but trying to scale it up is where I'm unsure on how it works. I already explained I was trying to do this without scriptable objects, but I was constantly told that scriptable objects would make it all a lot easier, which is where my confusion comes into this. Worst part about self-teaching is you don't know what things are normally called/correct terminology/anything like that aha. Generic class that can't be instantiate.Click to expand.I think I've been entirely misunderstood, but I'm not sure what other way to word it, my apologies. Inheritance means it will have everything from the parent plus stuff of his own and often overridden functions of the parent.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |