A
A
Alexander2020-11-19 12:02:49
C++ / C#
Alexander, 2020-11-19 12:02:49

I can't pass an array to another Unity class, but what's wrong?

There is a class that inherits from the parent, the parent has an array that has get; set;
However, in the child class it is filled, while in the parent class it remains empty.
Tried the same with creating a structure. The same.

Parent class:

internal ComputerStructForSend[] Computers = new ComputerStructForSend[5];


Child:

Computers[countCompsAdded].cpu = Field[0].text;
                Computers[countCompsAdded].ram = Field[1].text;
                Computers[countCompsAdded].hardcount = Field[2].text;
                Computers[countCompsAdded].count = Field[3].text;
                Computers[countCompsAdded].year = Field[4].text;


Everything is filled in it, however, when loading from another script, these structures, like the same arrays, are empty.
The parent class is responsible for storing the data.
What is being done wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2020-11-19
@Jewish_Cat

Well, you have a testFunc () function that unloads data into your array.
But in your VisibleTest there is no call to this function. Therefore, there will be no data there -_-

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question