Trying to follow an old tutorial but what changed? (I think it's something to do with arrays)

Hello I’m doing a Masters Degree in Renewable Energies and I found a video on simulating solar panels in UE4. The video was very detailed and I followed it exactly but when I compile it doesn’t work. There are some comments on the video talking about that the engine changed in the meantime so the code isn’t exact anymore. I’ve been trying to find the problem and I think I found it.

The video that I followed is this one: UE4 Energy Generation Series - Tutorial 5 Part 1/2 - Solar Panel - YouTube

The only thing that changed noticeably from the tutorial from 2018 it’s this

image

In the video when he gets component by class the return value it’s already in array mode, but in my BP it has to be converted in array.

I think that this is the problem because when I do the condition later it returns false.

The solar panel is an actor that has 6 cells (static mesh component) called "Cell1, Cell2, Cell3… and a Base)

PD: For some reason if I compile normally it doesn’t work at all, but when I compile the solar panel and press play it work only for one cell and it doesn’t produce power. But that’s unrelated I think.

I don’t have any Idea of UE4 (I only created maps for UT99 when I was like 10 haha), I just tried because I wanted to start using UE4 and it’s seemed like a fun thing to do to get used to it.

Thanks in advance!

Haven’t heard about changes in basic stuff.
First of all, use for loop to print out names of each element in the array before, to understand does it contain all that you need or not.

The “Get Component by Class” node in your screenshot will only give the first found component, there should be a “Get ComponentS by Class” node that will give you the array output with all components.

Both nodes pops up when you start searching for “get componen…” so you likely just clicked on the wrong one a bit too quick

4 Likes

If it’s already an array, just drag off and find the for each loop.

It’s always better to make the nodes by dragging, rather than trying to connect them together. This is because the engine already has implied types in the placed nodes.

image

My bet is that you simply plopped down the incorrect node. edit: as per @sportbil comment - read it too late.

■■■■ yeah that was it haha tanks!