Question by
erik7302 · Nov 25, 2016 at 02:32 AM ·
error message
Help me have multiple mistakes
Assets/Enemy.cs(19,27): error CS0019: Operator +' cannot be applied to operands of type
UnityEngine.Vector3' and float' Assets/Enemy.cs(19,64): error CS0023: The
+' operator cannot be applied to operand of type `UnityEngine.Space' Script: using UnityEngine;
public class Enemy : MonoBehaviour {
public float speed = 10f;
private Transform target;
private int wadepointIndex = 0;
void Start ()
{
target = Waypoint.points[0];
}
void Update ()
{
Vector3 dir = target.position - transform.position;
transform.Translate(dir.normalized + speed + Time.deltaTime, + Space.World);
if (Vector3.Distance(transform.position, target.position) <= 0.2f)
{
GetNextWaypoint();
}
}
void GetNextWaypoint()
{
if (wadepointIndex >= Waypoint.points.Length - 1)
{
Destroy(gameObject);
}
wadepointIndex++;
target = Waypoint.points [wadepointIndex];
}
}
Comment
Answer by hexagonius · Nov 25, 2016 at 05:52 PM
transform.Translate(dir.normalized + speed + Time.deltaTime, + Space.World);
the first two + need to be *
Your answer
![](https://koobas.hobune.stream/wayback/20220612101344im_/https://answers.unity.com/themes/thub/images/avi.jpg)