other=gameObject.GetComponent("knifeRay01");
other.isHit=true;
other.rayPosition=hit.transform.position;
as you see,it is a segament of my sript ,which i was trying to modify two variable in the other sript called “knifeRay01” just as the told,but when i complied it ,here is the warning:
WARNING:Implicit downcast from ‘UnityEngine.Component’ to ‘knifeRay01’.(BCW0028)
what is this meaning?i can’t figure out
please help ,thank you !
The GetComponent call as it stands returns a Component value, which is less specific than your knifeRay01 type. You can eliminate the warning using the generic version of GetComponent:-
ther = gameObject.GetComponent<knifeRay01>();
I would recommend just removing the quotes instead.
The generic version is a tiny bit slower, and uglier, so there’s no reason to use it in Unityscript. You almost never want to use quotes in GetComponent; removing them makes it return the correct type instead of Component.
–Eric