How do i go to differant scripts in other objects on touch. Please edit this script:
function Update()
{
transform.position += transform.up * 30 * Time.deltaTime;
}
function OnTriggerEnter (otherTwo : Collider)
{
if (otherTwo.gameObject.CompareTag("Enemy"))
{
var other:String = "Health";
var curTransformTwo = GetComponent(otherTwo);
var curTransform = curTransformTwo.GetComponent(other);
curTransform.health += -1;
Destroy (this.gameObject, 0.1F);
}
}
There at Update, makes a bullet fly.
I cannot understand this:
Assets/Fly.js(12,62): BCE0023: No appropriate version of 'UnityEngine.GameObject.GetComponent' for the argument list '(UnityEngine.Collider)' was found.
and:
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetProperty (System.Object target, System.String name)
UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
Fly.OnTriggerEnter (UnityEngine.Collider otherTwo) (at Assets/Fly.js:13)
I have tried fixing them but they do not do anything when i try except make more errors.
What i want to do is add 1 to the health script that is located in a object called Enemy with a tag of Enemy. The colliders are working.