I have the following property, which I call in Awake:

private WheelCollider frontWheelCollider;
    public WheelCollider FrontWC {
        get {
         if (frontWheelCollider == null)
             {
                GameObject colliderObj = new GameObject("FrontWheelCollider");
                colliderObj.transform.parent = BikeColParent;
                colliderObj.transform.position = FrontWT.position;

                frontWheelCollider = colliderObj.AddComponent<WheelCollider>();
                frontWheelCollider.transform.rotation = FrontWT.rotation;
                frontWheelCollider.suspensionDistance = suspensionDistance;
                frontWheelCollider.radius = frontWheelRadius;
                frontWheelCollider.mass = wheelMass;

                JointSpring js = frontWheelCollider.suspensionSpring;
                js.spring = springForceFront;
                js.damper = damperForce;
                js.targetPosition = targetPosition;
                frontWheelCollider.suspensionSpring = js;

                WheelFrictionCurve wf = frontWheelCollider.sidewaysFriction;
                wf.stiffness = 0;
                frontWheelCollider.sidewaysFriction = wf;
             }
            return this.frontWheelCollider;
        }
        set {
            frontWheelCollider = value;
        }
    }

Awake()
{
     // Cache player's wheelcollider components
    foreach (WheelCollider wc in playerGO.GetComponentsInChildren<WheelCollider>())
    {
        if (wc.name == "frontWheelCollider")
        {
            frontWheelCollider = wc;
        }
    }
}

Is the code above, which create a new WheelCollider, too much for a get{} accessor? Thanks in advance!

Stephane

The get accessor is just another function. You can put as much code as you like into it.

However, design-wise, it would be better to move all the code in the get accessor to another function.

public MyObject {
       get {
           return GetObjectInfo();     
           }
}

The idea here is to practice re-use; you may need the information in some other part of your code. It also makes your accessor clearer to read. The intent of the accessor is to return or to set some value. Having other code there which directly doesn't relate to that purpose could clutter its meanings.