How to know what random number is chosen

I’m using Random.Range to pick a random card from an array, I’d like to delete it from the array afterward, but how do I know which index number he picked at random?

var CurCard = Instantiate(P1Deck[Random.Range(0, P1Deck.Length)], CardLocations[LocationNumber].transform.position, CardLocations[LocationNumber].transform.rotation);

You can’t use RemoveAt with arrays. Use List instead.

Question needs more code. At the very least include P1Deck’s declaration.

But since you’re getting a ‘not a member of GameObject’ error it sounds like maybe P1Deck was implemented like:

 var P1Deck: GameObject[] = new GameObject[1];

In which case you would need to modify it in to a Javascript array that does support RemoveAt.