using get; set; property to get and set the value of an existing variable in another script. (see code)

so i have unitfacade which is a class that basically contains the commonly used functions from all the various scripts on a unit so you for example call the move function from the script that deals with pathfinding and the target function from the script that deals with that. It’s not all the functions possible, it’s just the top 20% that you’ll use 80% of the time.

I then have unitbase which basically is one of those scripts which the facade pulls from, one of the things it does is store the current target of the unit.

What I want is unitfacade to have the property Target you can get and set that actually in it’s getting and setting, gets and sets the unitbase property. so it looks something like this I THOUGHT.

Class UnitFacade
{
    UnitBase _unitBase;

    public Transform Targeted
    {
        get
        {
            return _unitBase.Targeted;
        }
        set
        {
            _unitBase.Targeted = Targeted;
        }
    }
}

but that apparently doesn’t work. I’m not sure why.
Anyone explain what i’m doing wrong or how to do this properly.

I think you just need to change the set method to be

_unitBase.Targeted = value;

value is a reserved word that will take whatever was on the right side of the original assignment statement.