Animator on a WorldSpace Canvas

Ok, so I have my world space canvas attached to the player object. In my script I have a reference like this :

 GameObject myWorldCanvas;

Awake()
{
myWorldCanvas= transform.FindChild("nameOfObject").gameObject;
}


Then when the right conditions are met I simply activate the object like this :

myWorldCanvas.SeActive(true);


This worked perfectly until I added a animator to the object. If I manually enable/disable the object in the scene the animation works perfectly(it just changes the scale to give it a pop effect), but when the object is activated by my script the animation still plays and changes the scale values but nothing is rendered. In play mode if I manually enable/disable the animation works.

Any ideas ? If you need more info or screens let me know.

Edit : the canvas has some buttons as children and when I mouse over something seems to be refreshed and the images show up on screen.

Edit: Further test have show that manually disabling and enabling the Canvas component also shows the images, but If the canvas and game object are enabled from a script nothing shows up on the screen.

Edit: I solved the problem by disabling the canvas component on the first key of the animation and then enabling it on the second one where the Y scale is set to 0. This seems more like a hack and I dont like it. Does anyone have a idea why this is happening ?

• your question is confusing.please provide a video or picture for describing your mind.but I think you can fix your problem by myWorldCanvas.GetComponent<MeshRenderer>().enable = false; please try this and tell me result. – Seyed Morteza Kamali Apr 15 '16 at 11:03
• there is no MeshRenderer on the object it's a canvas. As for clarification I cant do video right now, will try to make a few screenshots. – Uri Popov Apr 15 '16 at 11:09
• ok,so try this: myWorldCanvas.GetComponent<Canvas> ().enabled = false; I guess SetActive create your problem maybe you can solve it by this way. – Seyed Morteza Kamali Apr 15 '16 at 11:18
• @smkplus Disabling the Canvas component will only make sure that the UI elements are not visible. Maybe you dont understand my problem at all. – Uri Popov Apr 15 '16 at 11:27