Timeline for Assign a ScriptableObject to MonoScript through code
Current License: CC BY-SA 3.0
21 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 9, 2016 at 9:38 | vote | accept | Valamorde | ||
| May 30, 2016 at 8:53 | history | edited | Valamorde | CC BY-SA 3.0 |
added 47 characters in body
|
| May 27, 2016 at 7:47 | answer | added | Muhammad Faizan Khan | timeline score: 1 | |
| May 27, 2016 at 6:21 | comment | added | Valamorde |
@volvis It might be. The general idea is to make a system. A general template (ScriptableObjects) for all weapons and only one script in the scene that will load any one of the weapons.asset to the scene. From all the ideas I've had on how to make such a thing this was my best one.
|
|
| May 27, 2016 at 5:34 | comment | added | volvis | I'm left wondering why do you want to attach assets during runtime and not in editor? Sounds a bit counter productive to be honest. | |
| May 26, 2016 at 23:20 | comment | added | Draco18s no longer trusts SE |
Resources.Load returns an Object by default. You just need to cast it, or use Resources.Load("") as [Whatever]. Mind, I don't know what Type "the entire contents" is returned as. Exercise for the reader.
|
|
| May 26, 2016 at 20:49 | comment | added | Valamorde |
@Draco18s Ok, subquestion though, with Resources.Load("") how could I ganerate a List<> or an Array[] of all the resources?
|
|
| May 26, 2016 at 20:42 | comment | added | Draco18s no longer trusts SE |
Yes. The "Resources" folder is sort of a "keyword" that tells the compiler "bundle this stuff, it's used by code." See the docs. Loading things, per my examples, would be Resources.Load("[object]") and Resources.Load("Scritable/[object]") respectively.
|
|
| May 26, 2016 at 20:02 | comment | added | Valamorde | @Draco18s so as long as there is a folder named resources it will load the asset? When the game is built will it continue to work? | |
| May 26, 2016 at 18:29 | comment | added | Draco18s no longer trusts SE |
Resources.Load() is generally the way you get assets from the Project directory. Note that the object must be somewhere inside a folder called Resources. (Assets/Resources/[object] is fine, so is Assets/Objects/Resources/Scritable/[object])
|
|
| May 26, 2016 at 18:21 | history | edited | Valamorde | CC BY-SA 3.0 |
added 15 characters in body
|
| May 26, 2016 at 12:37 | history | reopened | House | ||
| May 26, 2016 at 8:58 | comment | added | Valamorde | @Byte56 Can you revise your judgement of this "exact duplicate"? | |
| May 26, 2016 at 7:16 | comment | added | Uri Popov | I dont think its a duplicate too. How do we unduplicate it ? | |
| May 26, 2016 at 6:19 | review | Reopen votes | |||
| May 26, 2016 at 12:41 | |||||
| May 26, 2016 at 6:19 | history | edited | Valamorde | CC BY-SA 3.0 |
one small change to make the question even more clear
|
| May 26, 2016 at 6:04 | history | edited | Valamorde | CC BY-SA 3.0 |
added 19 characters in body
|
| May 26, 2016 at 6:03 | comment | added | Valamorde | @byte56 This question is definitely not a duplicate! The "duplicate" provided has nothing to do with my question. I asked about .Assets from the library and the "answer" was for GameObjects in the scene. | |
| May 26, 2016 at 5:41 | comment | added | volvis | I don't see how this is a duplicate to one provided. GameObjects and ScriptableObjects are two different beasts. | |
| May 25, 2016 at 21:53 | history | closed | House | Duplicate of Unity: How to get a GameObject programmatically? | |
| May 25, 2016 at 21:49 | history | asked | Valamorde | CC BY-SA 3.0 |