Question by
oruen · Nov 26, 2016 at 07:06 PM ·
scripting problemshooterc# to javascript
How to GetComponent from c# to javascript
Hello, i would like to GetComponent from c# to javascript. is that possible? why is the part of "GetComponent" not working? var Effekt : Transform; var Dmg = 100; var ghost = GameObject;
function Update () {
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
if (Input.GetMouseButtonDown(0)&&ghost.GetComponent<killghost>().munition>0)
{
if (Physics.Raycast(ray, hit, 100))
{
hit.transform.SendMessage("ApplyDamage", Dmg, SendMessageOptions.DontRequireReceiver);
}
}
}
Comment
Answer by AngryKiwiArts · Nov 26, 2016 at 09:32 PM
You cant pull c# from js. there are ways to run the scripts and then reference them through standard assets folder but generally this does not work
Thanks for your answer :), so i have to change it into c# script then.
Your answer
