P
P
PyChan2020-07-04 23:19:39
C++ / C#
PyChan, 2020-07-04 23:19:39

Why does the class not see the variable?

There is an abstract class and inheriting from it

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class Angles4
{
    public Vector3 objpos;
    public float step;
    public Vector3 downleft;
    public Vector3 downright;
    public Vector3 upleft;
    public Vector3 upright;
    public Angles4(Vector3 _objpos, float _step = 1f)
    {
        this.objpos = _objpos;
        this.step = _step;
    }
    public void ChangeStep(float _newstep)
    {
        this.step = _newstep;
    }
    public virtual void setdownleft()
    {
        downleft = new Vector3(Random.Range(objpos.x - step, objpos.x), Random.Range(objpos.y - step, objpos.x), objpos.z);
    }
    public abstract void setdownright();
    public abstract void setupright();
    public abstract void setupleft();

}
public class RectShape : Angles4
{
    public RectShape(Vector3 _objpos, float _step) : base(_objpos, _step)
    {
        objpos = _objpos;
        step = _step;
    }
    public override setdownleft()
    {
        downleft = new Vector3(objpos.x - step, objpos.y - step, objpos.z);
    }
    public override setdownright()
    {
        downright = new Vector3(objpos.x + step, objpos.y - step, objpos.z);
    }
    public override setupright()
    {
        upright = new Vector3(objpos.x + step, objpos.y + step, objpos.z);
    }
    public override setupleft()
    {
        downright = new Vector3(objpos.x - step, objpos.y + step, objpos.z);
    }

}

The setdownleft, setdownright, setupright, setupleft methods are all highlighted in red. error - 5f00e43780a6b725416735.png
Where does this error come from?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-07-04
@PyChan

From ignorance of the sisharp, an error.
Returned value (tobish void) where lost?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question