if statement not working

im trying to store my vector3 for the position of z so when i swap back to 3d i can use the z axis at the same spot. im checking and the bools are working right but for some reason zaxis always displays as 0,0,0 when im in 2d mode even though it shouldnt be changing?

 Debug.Log(zaxis);
    if (dimcount.thirddimension == false) 
    {
        zaxis = transform.position;
    }
    
    if (Input.GetKeyDown(KeyCode.I) && dimcount.firstdimension == false) {
        
        Instantiate(firstperson, zaxis, Quaternion.identity);
        dimcount.thirddimension = false;
        dimcount.seconddimension = false;
        dimcount.firstdimension = true;
        Destroy(gameObject);
    }
    if (Input.GetKeyDown(KeyCode.O) && dimcount.seconddimension == false)
    {
        
        Instantiate(thirdperson, zaxis, Quaternion.identity);
        dimcount.thirddimension = false;
        dimcount.seconddimension = true;
        dimcount.firstdimension = false;
        Destroy(gameObject);

        
    }
    if (Input.GetKeyDown(KeyCode.P) && dimcount.thirddimension == false)
    {
        Instantiate(twod, new Vector3(transform.position.x, transform.position.y,0), Quaternion.identity);
        dimcount.thirddimension = true;
        dimcount.seconddimension = false;
        dimcount.firstdimension = false;
        Destroy(gameObject);
        
    }
}

Good day.

Are you sure what axis in 3D is the 2D X axis?
Same for Y axis.

Check it, depending on how you did the 2D projects, is possible they are swaped or rotated, or 2D XY is 3D XZ

Other thing can be that you are using position and LocalPosition, theyare not the same. Check for it also.

bye!