- Home /
This question was
closed Sep 27, 2020 at 06:30 PM by
twotostudio for the following reason:
Other
Question by
twotostudio · Sep 26, 2020 at 09:26 PM ·
variableintincrease
controlling the increment in the variable
public class move : MonoBehaviour
{
public GameObject lefthand;
public Transform[] lchilds;
public int lcount;
private void Update()
{
lchilds = new Transform[lefthand.transform.childCount];
lcount = lefthand.transform.childCount;
for (int i = 0; i < lefthand.transform.childCount; i++)
{
lchilds[i] = lefthand.transform.GetChild(i);
if (if the variable i increases by 1)
{
//my codes
}
}
}
I have a array like this. And I have a code that should work every time a new object is added to the array. How can I determine if the array length increments by 1? I tried to explain the required situation in the codes.
Comment
Answer by N-8-D-e-v · Sep 26, 2020 at 11:43 PM
You have created a for loop, integer "i" will increment every time no matter what
then can i check lcount increase? Or how can I do? I have codes that need to run once when the number of elements of the array increases.
Follow this Question
Related Questions
detect if a variable has stop increasing 4 Answers
Pass a function(float) as variable 2 Answers
How to write "if (var int = var int 2)" ? 1 Answer
Cant get platerprefs to work 3 Answers