Beginner Scripting: GetComponent
This weeks coding task looked at the GetComponent function. This function helps to access other scripts attached to the same game object. A key factor in this is that there must be public variables, not private in order to obtain. It can also be used to access other components that are not exposed by the API. It uses up a lot of processing power and shouldn't be used over and over as this will waste a lot of your processing time. Its good practice to call it in the Awake or Start functions or only once when its first needed.
The script is as follows
UsingOtherComponents
AnotherScript
YetAnotherScript
Comments
Post a Comment