Need Help Getting my player to mergr into a painting


I am working on a 2d project where I would like my player to merge into paintings on the wall and walk along them then pop/step out.

Unfortunately I do not know how to code this any help would be greatly appreciated

Thank you

You could have a boolean on a player script to signify if you are on a painting.
Then you can have a script on every collider with another boolean for if it is a painting.

public class PlayerScript : MonoBehaviour {

public bool isOnPainting;

void Update () {

if(Input.GetKeyDown(KeyCode.Space)) {
isOnPainting = !isOnPainting;

foreach (GameObject Collider in GameObject.FindObjectsOfType<Collides>().gameObject) {

if(isOnPainting) {
Collider.GetComponent<Collider>().enabled = Collider.GetComponent<Collides>().isPainting;
} else {
Collider.GetComponent<Collider>().enabled = !Collider.GetComponent<Collides>().isPainting;




Something Like That, But I Haven’t Checked it for Compiler Errors
You can also change your player’s size or position

Thanks for the help, it helped me figure out how to get it to work