rds1983 / Myra

UI Library for MonoGame, FNA and Stride
MIT License
704 stars 93 forks source link

ImageButton "Unable to resolve AssetLoader for type" when provided null #338

Open Humanphyti opened 2 years ago

Humanphyti commented 2 years ago

Working with Myra in Monogame trying to add an ImageButton to the starting screen of a game. Followed the wiki on creating a button without a specific style as there is no need for styles in my UI. Below is my code for the ImageButton creation and the declaration of the ImageButton above. All the error reports is "Unable to resolve AssetLoader for type" which is less than useful in debugging the underlying issues.

`private ImageButton startLabel;

startLabel = new ImageButton(null); startLabel.Id = "PressStartButton"; startLabel.Background = pressStartStatic.Renderable; startLabel.HorizontalAlignment = HorizontalAlignment.Left; startLabel.VerticalAlignment = VerticalAlignment.Top; startLabel.Top = (int)(_viewportHeight / 1.8f); startLabel.Left = (int)(_viewportWidth / 5.3f); startLabel.Width = pressStartStatic.Renderable.Size.X 6; startLabel.Height = pressStartStatic.Renderable.Size.Y 6; startLabel.Toggleable = true; startLabel.ZIndex = 1; panel.Widgets.Add(startLabel);`

rds1983 commented 2 years ago

Sorry for the late reply, did you call MyraEnvironment.Game = this; before everything?