Quantcast
Channel: Latest Questions by t9s1n2
Viewing all articles
Browse latest Browse all 40

How do i pass a script as an argument to a function?

$
0
0
I want to make a generic function in another script that needs a script as an argument. The code would look something like this void Health (? (not sure what goes here) script) { script.health = 10; } This function could be used by multiple different scripts, for example enemy and player. Health(GetComponent()); Health(GetComponent());

Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>