- Home /
empty component var
So I will be calling a script component like so var Cld: Colliding2 = transform.GetComponent(Colliding2);
but some times if it is an ai controlling it will look like this var Cld: AI = transform.GetComponent(AI);
How would I make a var at the beginning of the script that is empty so I can do. var Cld : component;
if (transform.GetComponent(Colliding2) != Null) {Cld = transform.GetComponent(Colliding2);} if (transform.GetComponent(AI) != Null) {Cld = transform.GetComponent(AI);}
Comment
Answer by Xavier78 · Jul 23, 2015 at 02:01 AM
any one, just need to know how to make/formatting of a component variable.
also I need it in java, I found one in C, but I have no clue how to convert that.