Create Button via Script not working

I have a code that take canvas and button prefab but after I run the code. 1) The button is not inside the canvas I instantiated. 2) I don’t see any button being instantiated in my game scene (but there is one in hierarchy )`public GameObject buttonPrefab;
public GameObject canvasPrefab;

 // Use this for initialization
 void Start () {

     Canvas canvas = Instantiate (canvasPrefab, Vector3.zero, Quaternion.identity) as Canvas;
     Button button = Instantiate (buttonPrefab, Vector3.zero, Quaternion.identity) as Button;
     button.transform.SetParent (canvas.transform,false);

 }`

Thank you very much.

Try to define and instantiate the canvas and button as GameObject

you defined them as GameObject variables and you should also try to Instantiate them as GameObjects:

GameObject canvas = Instantiate(canvasPrefab, Vector3.zero, Quaternion.identity) 
as GameObject


etc.