How to change array length

How to i can change array length.

public GameObject items;

void OnMouseDown(){
items.Length-=1;
}

it’s possible?

As @Slobdell said, built-in arrays can’t be directly resized - but you can do it the hard way:

GameObject[] temp = new GameObject[newSize];
items.CopyTo(temp, 0);
items = temp;

This code creates a temporary array temp with the desired size and copy to it the elements of items, then assign temp to items, effectively changing the size of the items array.

But if you need to change the array size very frequently (every frame, for instance), it’s better to use the List class.

No, arrays are immutable. I’m not sure what language you’re using but in c# you can use a list and it is sizeable. Grows when you add and shrinks when you remove. But in your particular case it seems strange what you’re doing resizing the array without doing anything to its contents. What are you trying to do?

Well, you dont need to worry about this.
static int value;
GameObject newArr;

void anyFunction()
{
newArr = new GameObject[value];
}

//Any function can change array length,

----------------This code is work--------

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraManager : MonoBehaviour
{
   public int ElementValue = -1;
   public Vector3 CameraPosition;
   public Vector3[] items = new Vector3[1];
   public Vector3[] items_Backup=new Vector3[1];

    // Start is called before the first frame update
    public void Record()
    {
        CameraPosition = Camera.main.transform.position;
    }
    public void SaveElement()
    {
        ElementValue++;
        items_Backup = new Vector3[ElementValue+1];
        items.CopyTo(items_Backup, 0);
        items = new Vector3[ElementValue];
        items = items_Backup;
        items[ElementValue] = CameraPosition;
    }

}