You really should create a complete Unity C# course, even if you did so in Udemy for a cost: I'd totally pay for it because you make complex things into simple ones. Looking forward for your next tutorials!
Already liking this after 2:22 in and I LOVE you for giving me the answer, just like that! Looking forward to seeing the rest of the video, great explainer! Thank you kindly! Also I LOVE your accent :D
@@Digestible you're welcome! I do have a question though if you don't mind. I'm using this method to instantiate a hand of cards from a deck. How would I go about instantiating the prefabs on a specific game object (an empty game object called "hand"), and making them the child of that object?
@@andrewmettler2228 Luckily it looks to be not a big deal to do this (just tried it out and it seemed to work fine) 1) create the empty game object in the hierarchy 2) in the script define the parent object (I put this line right below the line where i set up the list - in the class but not in a method: public Transform parent; //in this example i'm just calling it "parent" 3) add an additional parameter to the instantiate command to include the parent object. If I used the example from this video it would look like this: Instantiate(targetList[i], new Vector3(randomx, 0, randomz), Quaternion.identity, parent); 4) save your script & go back into unity 5) click on the object that holds your script in the hierarchy - you should now see a spot in the inspector called "parent". Drag your empty gameobject to it. 6) Run it and now the prefabs will be instantiated into the parent. You may have to change how you have the positions set up for your own example (you likely dont want a random x and z value,...) but this should add them as children. also, here is the Unity documentation that shows all the variations you can use with Instantiate - you may not need the same rotation/position settings and such so you might be able to pick a different one that includes the parent docs.unity3d.com/ScriptReference/Object.Instantiate.html
Good afternoon....I have one question.....if I would like to instantiate a prefab with drop-down....when I instantiate the one of the prefab, I would like to destroy the rest of the instantiate prefab which are already instantiate......
Sorry to interrupt you from all those compliments, but somehow I typed “ TextAsset text = (TextAsset) Resource.Load(file name) Debug.Log(text);” and the output is null. Which means the program deemed the file/folder were not existed Which it existed in the Resources. Can you explain how to deal with it?
note: I havent personally used code specific to what you posted so at this point I'm just taking a couple of guesses. It's hard to tell without seeing your complete script BUT I think one thing to start with is that you have a typo - you are missing the "s" in Resources.Load (you have Resource.Load). (i'm also assuming that "file name" is a placeholder for your actual filename just for this post? otherwise that would cause an issue as well ) The other thing I wonder if trying to debug.log the TextAsset directly may not work - you may have to use .text to access it (in this case text.text) And, It may not be a problem but naming a variable "text" may also cause confusion with the code since "text" is used as a property as well (might be better to name it something not a keyword) check out this stackoverflow entry - the top answer has code similar to what you are trying stackoverflow.com/questions/21583104/unity-load-text-from-resources
Thank you! I have learned so much from this video! I am curios if it is possible to define a script that will loop between game objects within the list. Only having once active at a time.
You totally could do that. Instead of using a random number as the index of the list as i did in this example you would then use a variable to keep track of the item it is on and then increment (or decrement) the index to loop through. I have a video on how to do this with arrays - it would work the same for lists. Here is the video: ruclips.net/video/MkjVU5F1it0/видео.html
I needed something very simple to create a working code example of my first List. This did the trick.
You really should create a complete Unity C# course, even if you did so in Udemy for a cost: I'd totally pay for it because you make complex things into simple ones. Looking forward for your next tutorials!
Wow thanks for such a nice compliment!
agree
This helped me get the ball rolling on a spell system for my Player, thank you.
i have to confess that you r th best who expaned this well even unity devs dont know how to explain like you
Thanks!
Great video, I love the relax and informative tone and the examples are spot on!!
Thanks!
Already liking this after 2:22 in and I LOVE you for giving me the answer, just like that! Looking forward to seeing the rest of the video, great explainer! Thank you kindly!
Also I LOVE your accent :D
Thanks for the nice comment! I appreciate it!
Ma'am, you are a life saver. I have been struggling to figure this out for months. Thank you so much!
Thanks for such great feedback! I'm glad that it helped you!
@@Digestible you're welcome! I do have a question though if you don't mind. I'm using this method to instantiate a hand of cards from a deck. How would I go about instantiating the prefabs on a specific game object (an empty game object called "hand"), and making them the child of that object?
@@andrewmettler2228 Luckily it looks to be not a big deal to do this (just tried it out and it seemed to work fine)
1) create the empty game object in the hierarchy
2) in the script define the parent object (I put this line right below the line where i set up the list - in the class but not in a method:
public Transform parent; //in this example i'm just calling it "parent"
3) add an additional parameter to the instantiate command to include the parent object. If I used the example from this video it would look like this:
Instantiate(targetList[i], new Vector3(randomx, 0, randomz), Quaternion.identity, parent);
4) save your script & go back into unity
5) click on the object that holds your script in the hierarchy - you should now see a spot in the inspector called "parent". Drag your empty gameobject to it.
6) Run it and now the prefabs will be instantiated into the parent.
You may have to change how you have the positions set up for your own example (you likely dont want a random x and z value,...) but this should add them as children. also, here is the Unity documentation that shows all the variations you can use with Instantiate - you may not need the same rotation/position settings and such so you might be able to pick a different one that includes the parent docs.unity3d.com/ScriptReference/Object.Instantiate.html
Thank you! This is the video I've been looking for! and as all of your previous ones the quality is absolutely great!
Thanks! I'm glad it helped!
This is such a good channel! Thank you! Hope you keep going, you deserve way more subscribers.
Thank you thank you!
would love to see more videos from you .. :D
You have just saved the Dwarves of Norr, from my game, thank you!
Glad to hear it! Always happy to save dwarves!
exactly what I wanted to know, thank you so much.
Awesome - glad it helped!
Helpful Tutorial,
Thanks
THANK YOU SO MUCH
You're welcome!
Good afternoon....I have one question.....if I would like to instantiate a prefab with drop-down....when I instantiate the one of the prefab, I would like to destroy the rest of the instantiate prefab which are already instantiate......
Sorry to interrupt you from all those compliments, but somehow I typed “
TextAsset text = (TextAsset) Resource.Load(file name)
Debug.Log(text);” and the output is null.
Which means the program deemed the file/folder were not existed
Which it existed in the Resources.
Can you explain how to deal with it?
note: I havent personally used code specific to what you posted so at this point I'm just taking a couple of guesses.
It's hard to tell without seeing your complete script BUT I think one thing to start with is that you have a typo - you are missing the "s" in Resources.Load (you have Resource.Load). (i'm also assuming that "file name" is a placeholder for your actual filename just for this post? otherwise that would cause an issue as well )
The other thing I wonder if trying to debug.log the TextAsset directly may not work - you may have to use .text to access it (in this case text.text) And, It may not be a problem but naming a variable "text" may also cause confusion with the code since "text" is used as a property as well (might be better to name it something not a keyword)
check out this stackoverflow entry - the top answer has code similar to what you are trying stackoverflow.com/questions/21583104/unity-load-text-from-resources
Thank you! I have learned so much from this video! I am curios if it is possible to define a script that will loop between game objects within the list. Only having once active at a time.
You totally could do that. Instead of using a random number as the index of the list as i did in this example you would then use a variable to keep track of the item it is on and then increment (or decrement) the index to loop through. I have a video on how to do this with arrays - it would work the same for lists. Here is the video: ruclips.net/video/MkjVU5F1it0/видео.html
Thank you!
thanx)
Great video! I dont know why on my part is only creating me a DontDestroyOnLoad with a childObject called [Debug Updater].
This video is obsolete