Dude! what a great tutorial , amazing teacher! as a begginer in game dev i had an aproach like the first one you shown ... this is great! i didnt think about using an abstract class , great choice!
@anandev7 ай бұрын
Yessss! Thank you so much for your kind words! 😌 Using Inheritance in almost everything I code, made all my scripts that much simpler and scalable. You can also use virtual functions to spice things up on top of that, and we level up everytime we do it! 💪🏻
@marularch Жыл бұрын
Great simple explanation, thanks for the video.
@anandev Жыл бұрын
You're welcome! I'm glad it was useful.
@pitchayaouyta1812 Жыл бұрын
Ayo this is one of the best tutorials so far
@anandev Жыл бұрын
Aww! Thank you so much!
@mikehellio Жыл бұрын
keep up with that good tutorials, you are a good teacher
@anandev Жыл бұрын
Aw! Thank you so muchh! It means a lot 🥰
@tangaroranguzzikeirb.9264 Жыл бұрын
nice its finally here thankss
@anandev Жыл бұрын
Yeah sorry for the delay, had some personal affairs
@tangaroranguzzikeirb.9264 Жыл бұрын
@@anandev its fine😊
@tangaroranguzzikeirb.9264 Жыл бұрын
keep teaching i really like the way you teach
@anandev Жыл бұрын
Thank you very much 🥰 It means a lot to me...
@tangaroranguzzikeirb.9264 Жыл бұрын
@@anandev You're Welcome hehehe 😍
@anandev Жыл бұрын
@@tangaroranguzzikeirb.9264
@krishnanramdas9142 Жыл бұрын
Big fan❤
@anandev Жыл бұрын
Thank you very much! 😍❤
@tangaroranguzzikeirb.9264 Жыл бұрын
public class ShowUI : MonoBehaviour { public GameObject uiObject; void Start() { uiObject.SetActive(false); } // Update is called once per frame void OnTriggerEnter(Collider player) { if (player.gameObject.tag == "Player") { uiObject.SetActive(true); StartCoroutine("WaitForSec"); } } IEnumerator WaitForSec() { yield return new WaitForSeconds(5); Destroy(uiObject); Destroy(gameObject); } } What do i need to make this collectable in order like 1,2,3.
@anandev Жыл бұрын
The class that you have shown doesn't give me enough context to solve your problem. Wanna chat on discord?
@anandev Жыл бұрын
Here is the discord server link: discord.gg/kVjSMDHMda
@zelos666 Жыл бұрын
And just like that you now need 4 entire scripts instead of 1. I would argue this is absolutely not cleaner and better. It just makes script navigation more confusing.
@anandev Жыл бұрын
Interesting! I would argue that script navigation is barely affected. Both Unity and IDEs have features that let you solve that issue (Search options, filters, etc.), and managing multiple files is actually better in my opinion because everything is supposed to be very well organized. However, creating a separate folder for all the collectible scripts is recommended. I also think it's a lot cleaner because it gets rid of unnecessary code! Not only is this better for performance, but it is also better for debugging purposes and enhances flexibility. If there is an error in one of your collectibles, you would only have to look in that child script to figure things out. You also get the advantage of adding fields in the inspector specific to individual collectibles! Creating one single script and putting all your code there is actually considered a bad habit, and would clearly make your code specific to that single project. This way, you can completely export the single Collectible script as a Unity Package and use them across all of your projects! This ticks all boxes for me.