When you create a new instance of an object in an event,this new instance become the default pick for that object within the same event, so you can just access the UID of the new instance like this:
On mouse click >> Create object of type Cube
>> Browser alert(Cube.UID) // will alert the UID of the cube you juste created