- Home /
Disable JS from C#
using UnityEngine;
using System.Collections;
public class blck_plc : MonoBehaviour {
void OnCollisionEnter(Collision collision){
collision.transform.GetComponent<plc>().enabled = false;
}
}
I´m disabling JS from C#. How can I fix this script?
Answer by Landern · Mar 11, 2015 at 06:08 PM
It would be nice next time if you actually posted the error.
Chances are you haven't put your C# scripts into a special folder(http://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html). During build it will throw an error due to the order in which things compile.
So go and read http://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html and put your scripts in a special folder. If something else is the issue, i would suggest that you actually post the error/exception that you're getting.
The type or namespace name `plc' could not be found. Are you missing a using directive or an assembly reference?
You have a class or file called plc.js?
Also: http://www.41post.com/1935/program$$anonymous$$g/unity3d-js-cs-or-cs-js-access
it´s script called plc and I want to disable it when happen collison...