i am trying to make my sliderjoint2d motor go left to its limits then right to its limits but i keep getting an error over “slider.motor” in “slider.motor.motorSpeed=1.5f;” telling me that I “Cannot modify the return value of ‘SliderJoint2D.motor’ because it is not a variable”
using UnityEngine;
using System.Collections;
public class SliderScr3 : MonoBehaviour
{
public SliderJoint2D slider;
// Use this for initialization
void Awake()
{
slider = this.gameObject.GetComponent<SliderJoint2D>();
}
void Start () {
if (slider.jointTranslation == -2)
{
slider.motor.motorSpeed=1.5f;//make motor go right for optional shooting
}
}
// Update is called once per frame
void Update () {
}
}