I know there are a lot of these posts out there, but they all seem to be specific to certain instances, not anywhere looking like mine.
The errors specific;
Assets/Script/BoundarySetting.cs(11,26): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
Assets/Script/BoundarySetting.cs(12,34): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
Assets/Script/BoundarySetting.cs(13,34): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
Assets/Script/BoundarySetting.cs(14,34): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
The code I wrote;
using UnityEngine;
using System.Collections;
public class BoundarySetting : MonoBehaviour {
public float edgexMin, edgexMax;
public float edgeyMin, edgeyMax;
// Update is called once per frame
void Update () {
edgexMin = Mathf.Clamp = new Vector3 (-9.4f, 0.0f, 0.0f);
edgexMax = Mathf.Clamp = new Vector3 (9.7f, 3.8f, 0.0f);
edgeyMin = Mathf.Clamp = new Vector3 (9.5f, -3.8f, 0.0f);
edgeyMax = Mathf.Clamp = new Vector3 (9.79f, -0.55f, 0.0f);
}
}
I am trying to make it so my dart sprite does not leave the canvas.
I know I’ve said this before but ANY help would be appreciated. I tried and tried using the wonderful new space shooter tutorial, he did a nice C# snippet about Mathf.Clamp but it doesn’t seem to work in Unity2D.
Thanks in advance folks.
Look up any example of
– Owen-ReynoldsMath.Clampand compare to what you wrote. Clamp is a function, which is a common programming thing. Lap, MoveTowards ... are also functions. Read about how function calls and parameters work (just any book about programming. Non-Unity C# books and web pages have the best explanations.)