Hi all,
I have just finished the C++ Unreal course and I have gone through the video where the mega-challenges are presented. I decided to tackle them starting with creating more guns and being able to cycle through them while playing, but I am not understanding arrays correctly and I am unable to continue.
Here’s what I have done so far:
I have created GunArray as shown below inside the ShooterCharacter class, which I intend for it to be an array where I will store the 2 blueprints for my guns in the editor:
I have created a blueprint class based on the C++ class Gun, just like we did for the BP_Rifle, and called it BP_Pistol. I have added both to GunArray in the editor, like this:
I have created another array, where I intend to store the pointers to the different guns I spawn (I suspect somewhere here is where the mistake is made):
And now what I would like to do at BeginPlay is the same that was done in the course for a single gun, but for an array: I would like to save the pointer to the spawned gun. I am attempting to do it like this, but it does not compile, and I get a squiggly line over the equal sign:
What am I doing wrong? Isn’t this what we did when we only had one gun?
This is the tooltip error shown:
And perhaps more importantly, is this the best way to go about implementing this?
I have set the mouse scroll wheel as an input, and my objective later will be to cycle through the index of this array based on the scroll wheel value (I have observed in the log that every wheel action is either + or -1).
Thank you all for your time,
Aaron