When an opponent casts a spell, if Veiled Sentry is an enchantment, Veiled Sentry becomes an Illusion creature with power and toughness each equal to that spell's mana value.
It triggers when the spell is cast, which means it becomes a creature before that spell resolves.