Prefab's collider2d.bounds.size is not set


Could you tell me when prefab’s collider2d.bound.size is loaded?

I have a simple script in which I want to print prefab’s size. Unfortunately size is always equal to (0.0, 0.0, 0.0) despite in editor it is equal to 170x205.

If I create new object from the same prefab in editor and then pass it to the script, size is set properly.

using UnityEngine;

public class SimpleScript : MonoBehaviour
    public GameObject prefab;

    private void Start()
        Debug.Log(string.Format("Prefab size: {0}", prefab.collider2D.bounds.size));

If you wanna get size of collider2d like in Editor, you must use something like this


When you use value “bounds” you get size in world’s units