unity move child relative to parent code example

Example 1: transform object according to its parent unity

transform.localPosition = new Vector3(12.5f, 12.5f, 12.5f);

Example 2: unity change position relative to parent

Use transform.localPosition instead of transform.position.
Works the same as transform.position if there is no parent.

Example :

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Example()
    {
        // Move the object to the same position as the parent:
        transform.localPosition = new Vector3(0, 0, 0);

        // Get the y component of the position relative to the parent
        // and print it to the Console
        print(transform.localPosition.y);
    }
}