0

I have this component "Physical Raycaster" and I want to disable/enable it through a js script.

Raycaster

Normally I use this code, but I can't figure out the name for the Raycaster?!

#pragma strict

var targetGameobject : GameObject;

function Start () {

targetGameobject.GetComponent(NAME RAYCASTER).enabled = false;

}
Gerald_LD
  • 101
  • 1
  • 8
  • Have you tried the unity documentation? – Eujinks Mar 03 '16 at 13:09
  • The script's name is visible in the "script" field. – Bart Mar 03 '16 at 13:38
  • 1
    hi @seanyt123 and bart. it is a real pain but if you just click to "close - duplicate" on such million-times duplicate questions, it is probably the best hope to keep the board working. there is so much clutter in the unity3d tag that it is becoming unusable here, which is a shame. – Fattie Mar 03 '16 at 13:54
  • hi all @seanyt123. I've tried the unity documentation but could not find the correct name (if tried several possibilities). Bart, i tried the script name "PhysicsRaycaster", but i get an unknown identifier error. And Joe Blow if seen that question before posting my own, and I don't need to know how to enable components, but how to get the name of this particular component. For it isn't simply a script, but an subselection-item within the event-type component of unity and i can't figure out how i can call that within the script. – Gerald_LD Mar 03 '16 at 17:16

1 Answers1

3

Try this:

targetGameobject.GetComponent<UnityEngine.EventSystems.PhysicsRaycaster>().enabled = false;