Basic syntax question about variables and methods -- unable to discern from tutorials

I’ve attached my script in case I’m no good at explaining the issue I am having.

I have several variables that will play a role in my script. In order to know what these variables are, I have to run some methods. For instance, I need to run a method I call DragResistance in order to calculate what the variable maxResistance will be, which will be used in another function in the script.

It seems I am doing something out of sync, though. I get all kinds of error messages. I cannot convert a float to a void, etc. I’m sure any competent programmer will see my error right away. I have reviewed the basic tutorials but it looks to me like I am doing things the right way. I just can’t figure this out.

Any help is greatly appreciated.

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

public class FlightControl : MonoBehaviour {

                   
    //USER CONTROLS***************************
    public float rollSpeed;
    public float pitchSpeed;
    public float yawSpeed;

    //PHYSICS VARIABLES******************************************************

    //The birds mass
    public Rigidbody theBird;
       
    //Upward and forward thrust generated by wing flaps
    public float thrustPower;
    public float upThrust;
    public float forwardThrust;



    //Air physics - Drag Resistance Applied Inverse to Velocity
    public float radius; //Radius of the flight object -- Higher equals more drag
    private float dragArea; //Area of the flight object -- in this case a sphere

    float resistanceFactor; // Resistance per k/m^3. Try to keep below 1
    float maxResistance; //Per cubic meter
    float velocityFactor;

    //Air Physics - Lift Force Inverse to Velocity
    private float airSpeed;
    public float requiredAirSpeedForFlight;
    private float lift;

    //***************************************************************************



       
       
       
       
    void Start()
    {
        SetInitialReferences();
        DragResistance ();

        velocityFactor = FindVelocityFactor ();
        resistanceFactor = FindResistanceFactor();
    }

    void FixedUpdate ()
    {
        LiftOff ();
        DirectionalControl ();
                   
    }

    void LateUpdate()
    {
        ApplyForce ();
    }

    void SetInitialReferences()
    {
        theBird = GetComponent<Rigidbody> ();
    }

    void DirectionalControl()
    {
    float h = Input.GetAxis ("Horizontal") * rollSpeed * Time.deltaTime;
    float v = Input.GetAxis ("Vertical") * pitchSpeed * Time.deltaTime;
    float y = Input.GetAxis ("Yaw") * yawSpeed * Time.deltaTime;

    theBird.AddTorque (transform.forward * -h);
    theBird.AddTorque (transform.right * v);
    theBird.AddTorque (transform.up * y);
    }
   

    void LiftOff()
    {
        if (Input.GetButtonDown ("Jump"))
        theBird.AddRelativeForce (0, upThrust, forwardThrust, ForceMode.Impulse);
       
    }


    void DragResistance()
    {
        //Get the constant area and maximum resistance
        dragArea = Mathf.PI * Mathf.Pow (radius, 2);
        maxResistance = dragArea * Math.Pow (resistanceFactor, 3);
    }

    void FindResistanceFactor()
    {
        direction = theBird.velocity.direction;               //Birds direction
        angle = Vector3.Angle (transform.forward, direction);    //Angle between bird direction and velocity direction

        return Mathf.Abs (Mathf.Sin (angle));                        //Return the resistance factor
    }

    void FindVelocityFactor ()
    {
        return theBird.velocity.magnitude;                        //Gets and returns the birds velocity magnitude
    }

    void ApplyForce()
    {
        float magnitude = maxResistance * resistanceFactor * velocityFactor; //Magnitude of air resistance
        Vector3 direction = transform.forward.normalized * -1;  //calculate the direction
        theBird.AddRelativeForce (direction*magnitude);        //Add the force to the rigidbody
    }

    void LiftEquation()
    {
        if (airSpeed >= requiredAirSpeedForFlight)
        {
            theBird.AddRelativeForce (0, lift, 0);
        }
    }

    void DefineLift()
    {
       
    }

    void FindAirSpeed()
    {
       
    }


    }

Every method has a type that it is expected to return. When you say a method has a void return type it means it returns nothing (ie - just executes some instructions). You have methods that are declared as not having a return type and then you are attempting to return things from them. So FindResistanceFactor is returning an absolute value of a float and therefore should have a float return type. Sames goes for FindVelocityFactor

Line 104, you aren’t returning a value but then you declare

return Mathf.Abs (Mathf.Sin (angle));

so change void FindREsistanceFactor to float FindResistanceFactor

This is true elsewhere.

@KelsoMRK beat me to it. lol.

Thanks so much, both of you.

You know, I thought that might be the issue, although I didn’t precisely understand why. I even changed the designation before the function names to float at one point, but I still had some kind of error messages. No doubt it was due to something else being out of whack.

I was just looking around, is there a list of possible types you can declare functions as? A list I could just browse through. I looked through the API and manual, but I only see things pertaining to Unitys built in functions like Start() and Update(). I

Methods can return any valid, declared type.