Public GameObject is looks Null

Hi to all firstly i m sorry about my english :frowning: i try to find a solution by myself but i didnt or i didnt understand because of my english :confused:
i have a product class

public class Product : MonoBehaviour
{
    public GameObject itemingame;
    public Product(GameObject itemingame){
        this.itemingame=itemingame;
    } 
}

and i have another class

public class ProductDataBase : MonoBehaviour
{
public GameObject x;
public ProductDataBase(){
Product product=new Product(x);
}
}

and in the third class

ProductDataBase productDataBase= new ProductDataBase();
debug.Log(productDataBase.product.itemingame);

but when i do this i saw null in console :confused: i dont know can i explain myself but i have a lot of class with connections they r calculating and sending something and every value is complately true except GameObject its always null :confused: i drag and drop in unity on public gameobject its not null.

i am sorry again and again for my english i hope some one can understand me :slight_smile:

Good morning / afternoon / evening @ProjectTogather !

Youโ€™re likely getting a warning within Unity stating something like โ€œYou are trying to create a MonoBehaviour using the โ€˜newโ€™ keyword. This is not allowed.โ€

In your case, if youโ€™re wanting to use your own constructors, you should avoid using MonoBehaviour.

public class ProductDataBase : MonoBehaviour

Iโ€™m personally not too sure what your goal is, but if you want to call some initialization code on a specific GameObject using MonoBehaviour, you can use the Start() or Awake() functions.

I hope this answers your question! =)

Cheers,

Curtis