Basically what the title says.
I have a few objects of the type scattered throughout the level but it always returns empty when i try to use it.
I have been following the tutorial from digitat tutors step by step and i cannot understand the problem.
Ok so i tested it out by calling it on event play instead of in the construction script and it works. Why doesn’t it work in the construction script now and why did it work in the tutorial?
Ok so i tested it out by calling it on event play instead of in the construction script and it works. Why doesn’t it work in the construction script now and why did it work in the tutorial?
Can you link this tutorial that you’re following? One thing that may change it is that Construction Script is something that is run when the object is placed in the viewport or translated in some way in the viewport. Construction Script is not something that is ever run while the game being played. Event OnBeginPlay is run as soon as you hit the ‘Play’ button and is part of the game instance. I can’t explain why it isn’t working in your case without more contextual information however.
Ah, seeing as you are probably trying to reference actors as part of your construction script, they most likely aren’t something that the construction script is able to see due to the order in which these things are run. Construction script is run before anything is considered to be in the scene.
Sorry for the late marking but I remember i marked the question as answered already. Yes it was because of the construction script. I moved it and it works.Thanks!