parent and child

1: my first problem is : i get exactly 44.9901 with me using this script

if(transform.eulerAngles.z==135)
{
transform.rotation = Quaternion.Euler(transform.eulerAngles.x,transform.eulerAngles.y,45);
}
i dont know why it’s 2d , there is no rigidbody nothing else except 2dcollider.

2: second problem is child and his parent ,
i had written this code to stop the child moving from the start pos while parent is constantly moving.

Vector2 trS = new Vector2(0,0);

child.transform.position = trS-parent.transform.position;

let me explain this code before you ask the meaning.

for example parent.trans.pos.x = 0 and child.trans.pos.x=0

if parent.tans.pos.x starts to change and become 1 unit for the child will stay 0 relative to the world but relative to his parent his pos.x=-1, but with my script it seem that they’re both running from trS(0,0)

3: the third one is the wierdest but i will post it on the first comment.
if you know the solution please make it quick i’m stuck until the answer arrives thank.

I think your second problem is because you are changing transform.position (position in world space) instead of transform.localPosition (position relative to parent).