is there a way to vary a function for different instances of the script?,is there a way to vary a function for different instances?
Hi. I am working on a turn-based rpg game and using the function UseBasicAbility() works fine, but if I attach the same script to a different character and want this character to have a different basic ability, is there a way I can vary the script for this second character so I its basic ability does something different or do I have to create a different script for each character in my game? Thanks in advance.,I am working on a turn-based rpg game. When I call a generic function of UseBasicAbility(), it works fine but then if I want to attach the same script to another character who's basic ability I want to do something different, can I do this or should I create a different script for each character in my game? Thanks in advance.
Answer by alexgamble · Aug 31, 2020 at 08:45 AM
I have been wracking my brain trying to find a way to do this, but then I remembered the other kind of coding language I use - Swift. It has something called a superclass in it which lets your classes inherit from others, which almost identical to Unity Inheritance, you can read more about it here - https://learn.unity.com/tutorial/inheritance#