No ObservableObject found

I am able to use my program through the Live Preview, but when I run it in a simulator it crashes and I get the following error;

Fatal error: No ObservableObject of type RollCode found. A View.environmentObject(_:slight_smile: for RollCode may be missing as an ancestor of this view.: file SwiftUI, line 0

Main View

ButtonView

Logic, ObservableObject

Maybe a silly question, but are you actually passing in a RollCode object to your GameView struct? You do it in your GameView_Preview but you haven’t posted anything that shows you doing it in the non-preview code. It should be done in either the main app struct or in a parent View to GameView.