press button with and have confirm unity code example

Example: press button with and have confirm unity

IEnumerator PlaceBuilding()
{
   // whatever you're doing now with the temporary / placement preview building
 
   ConfirmationDialog dialog = ShowConfirmationDialog(); // instantiate the UI dialog box
 
   while(dialog.result == DialogResult.None)
       yield return null; // wait
 
   if(dialog.result == DialogResult.Yes)
   {
       // place the real building
   }
   else if(dialog.result == DialogResult.Cancel)
   {
       // remove the temporary / preview building
   }
}