In this project when making the reference to the Canvas VictoryLayer how come we use @export var vs the Ctrl drag to make @onready VictoryLayer?
Is there a difference and why would you use one versus the other?
In this project when making the reference to the Canvas VictoryLayer how come we use @export var vs the Ctrl drag to make @onready VictoryLayer?
Is there a difference and why would you use one versus the other?
Hi Ryan,
onready is primarily used to ensure that the variable is ready to be used during the initialisation stage of running the game.
An export variable is just making it so we can access it in the inspector as sometimes its easier to drag and drop in the inspector than to find it by code.
It depends also on the number of times that we are doing it and in this case its just the once and easier to drag into the inspector.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.