Issue after adding rigidbox to 2d gameobjects

So im starting with unity, im doing a tutorial (Ruby’s adventure: 2d) And after adding the collision physics on the gameobjects with the Rigidbody2D function, the program started to malfunction: the collision is not where the gameobject is drawn and the size of the character changes (gets bigger) when going into play mode. So i have no idea how to solve this and i have followed the tutorial step by step.
tI havehe latest unity version installed, dont know if thats an issue.

If you would post a screenshot of your object’s components in the inspector, or a video of what you’re seeing, it would help inform us and possibly spot your mistake. Otherwise we’re just speculating.

I did another thread that has more detail https://forum.unity.com/threads/my-colliders-are-not-where-the-gameobject-is-drawn.762608/

Otherwise the images are the following:

Editor mode: https://imgur.com/YYfIGBU
Play mode: https://imgur.com/tR4YSMw
Colliders (red is where my character collides and yellow where the collider is supossed to be): https://imgur.com/imPjpTD

First, use code blocks:

public class RubyController : MonoBehaviour { Rigidbody2D rigidbody2d;

// Start is called before the first frame update
void Start()
{
rigidbody2d = GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");

Vector2 position = rigidbody2d.position;
position.x = position.x + 3.0f* horizontal * Time.deltaTime;
position.y = position.y + 3.0f * vertical * Time.deltaTime;

rigidbody2d.MovePosition(position);
}

}

Now let’s look at your code. Particularly this:

position.x = position.x + 3.0f* horizontal * Time.deltaTime;
position.y = position.y + 3.0f * vertical * Time.deltaTime;

This looks to me as you’re offsetting your position by adding 3.0f.

Your horizontal might be more efficient as:

position.x = position.x * horizontal * 3.0f * Time.deltaTime;

The reason I think this is because this would be your movement speed. You wouldn’t add that value to position.x or it’ll move that position over 3.0f which does seem to be what’s happening in your diagram.

Edit:

Perhaps I used the wrong arithmetic operator in that example, might need to be:

position.x = position.x + horizontal * 3.0f  * Time.deltaTime;

So when you really look what’s going on it’s this:

position.x = position.x + (horizontal * 3.0f)  * Time.deltaTime;