How do I print an array element when I don't know how to use arrays?

I’m following a tutorial which teaches how to make a tool. The script so far looks like this:

@MenuItem("Project Tools / Make Prefab")

static function CreatePrefab()
	var selectedObject : GameObject[] = Selection.gameObjects;

But the Unity console shows this

Assets/Editor/MakePrefab.js(9,19): BCE0005: Unknown identifier: ‘selectedObjects’.

Can anyone please help me?

On line 5 you declare “selectedObject”, but on line 7 you have typoed it as “selectedObjects”. Drop the extra “s”.

You define selectedObject but try to access selectedObjects. This is your problem :slight_smile: Remove the s.

Your debug should look like