Getting variable from instantiated clone instead of prefab C#

Here’s the problem. I want to get variables from cloned object script, but instead i get variables of prefab’s script. Code:


        public GameObject prefab;
        public Script script;
        public int value;

        void Start () {
        GameObject clone =(GameObject)Instantiate (prefab, transform.position, transform.rotation);

Editor indicates, that script indicates as [Prefab(Clone) (Script)], that means it refered to cloned object.

Well mabye you get the correct variables but they just have the same value on the clone and prefab. Is that a possibility?

When instantiating an instance from a prefab the instance variables will have the same values as the prefab. You will have to set the variables on the clone after it has been created via your script.