I need to be able to change the order in layer of some of my player game object’s children based on the player’s velocity. I have began by assigning the children to variables just after the class declaration:
public GameObject rightLeg;
public GameObject leftArm;
public GameObject leftEar;
public GameObject face;
I now need to store the sprite render components of these children, which I attempted to do in the start event:
leftLegSR = leftLeg.GetComponent;
rightArmSR = rightArm.GetComponent;
rightEarSR = rightEar.GetComponent;
This gives me an error, and this is obviously the wrong way to access the components of children. How should I do it? I want to change the variable in the sprite render named sortingOrder.