From Sonic Retro
The Phantom Ruby (ファントムルビー) is a mysterious gemstone with great power that appears in Sonic Mania and Sonic Forces. Shaped like a magenta icosahedron ruby, it is different from the Chaos Emeralds, but holds a remarkable power that can even counteract the power of the Emeralds and possibly even the Master Emerald. The kind of powers the Phantom Ruby can control are virtual reality control, including empowering and altering beings or creating illusory places and entities that feel real, although it can be used to distort space-time and create pocket dimensions such as Egg Reverie Zone and Null Space. It takes control of people's visual and depth perception to feed false information to the brain, creating a new reality for them.
According to Mania's digital manual, the stone was found by Dr. Eggman on Angel Island due to a unique wave signature emanating in the atmosphere. Upon theorizing that the gem had an unexplainable power, the scientist sent his elite group of Eggrobos to retrieve it. Upon being excavated, the power of the gem sends Sonic, Tails, Knuckles and the Eggrobos to Green Hill Zone and causes the Eggrobos to transform into the Hard-Boiled Heavies, giving them great powers and free will.
Throughout the game, Eggman takes the gemstone for himself, and uses it to displace the heroes at different places in space-time; a power similar to the Time Stones. By the time the heroes reach Titanic Monarch Zone, Eggman has mastered control of the gemstone and has used it to create portals around the fortress, and transformed the Hard-Boiled Heavies into "Phantom" versions of themselves.
If Sonic collects all the Chaos Emeralds and defeats the Phantom Egg, the Phantom Ruby sends him, Eggman and the Heavy King to Egg Reverie Zone, a mysterious pocket dimension created by the Ruby itself. Time and space are distorted within this pocket dimension, as the background is psychedelic and the timer in the HUD is malfunctioning. After Super Sonic defeats the Phantom King and the Klepto Mobile, the Phantom Ruby reacts with the Chaos Emeralds and opens a spatial portal that transports Sonic and itself to another dimension.
In the prequel comic, Rise of Infinite, the jewel is found by Eggman when the energy sensors of his new laboratory in the Arsenal Pyramid detect an unusual energy signature outside, prompting the scientist to investigate it. When he touches the gem, an illusion of Eggmanland is created, after which Dr. Eggman begins to research more about the object and names it the Phantom Ruby. At that very moment, his laboratory is attacked by the Jackal Squad, so he uses the Ruby to materialize a troop of Egg Pawns to exterminate them. The leader of the squadron attacks the doctor, but strikes the Ruby, causing a new illusion of a ruined world based on his own violent desire for change, after which Eggman makes a proposal for the leader to join his empire and achieve their mutual goals.
Prior to the events of the game itself, Eggman then researches deeper into the Phantom Ruby, constructing several bases and producing countless "Phantom Ruby Prototypes", with most having one or several fatal flaws that proved too risky to use effectively. Eventually, Eggman finalizes one of the prototypes and gives it to the Jackal Squad leader, who, after a humiliating beatdown at the hands of Shadow, casts away his previous identity and assimilates with the prototype after a number of experiments, becoming Infinite. Eggman does a test with the original Phantom Ruby, creating an illusion of Pachacamac's Village and having Knuckles and Silver fight an illusory copy of Chaos, then deems the test to be a success. Eggman and Infinite then put their plans to action by creating illusory copies of Shadow, Metal Sonic, Zavok and Chaos, defeating Omega and Sonic, and conquering 99% of the planet.
During the game, Eggman and Infinite go about destroying any and all Phantom Ruby prototypes so they don't fall into the wrong hands and potentially throw a wrench in their plans, but one of them falls into the hands of a rookie member of the Resistance, who discovers the prototype lying on the ground after a battle between Infinite and Silver in the Mystic Jungle, which would allow them to stop an artificial sun from crashing down onto the planet. The Resistance later destroys the Death Egg, which weakens the Phantom Ruby, but Eggman had anticipated that they would target the Ruby's power sources and built a backup power supply underneath Metropolis, with it regaining enough power to allow him to use the aforementioned artificial sun tactic. After the rookie foils that plan, the Ruby is weakened again, but recharges during Sonic's battle with Infinite. The heroes then destroy what is assumed to be the generator holding the Phantom Ruby, though it was later revealed to be powering Eggman's newest Death Egg Robot. The teamwork of both Sonic counterparts and the rookie ultimately neutralizes it for good.
Sonic Mania Plus
Although the Resistance had defeated Eggman, it turns out that the Phantom Ruby had survived the Death Egg Robot's destruction and had returned to the dimension it came from. Upon returning to Angel Island, the Ruby floats away somewhere, with Sonic chasing after it. This leads him to a capsule with old acquaintances, Mighty and Ray, trapped inside. After Sonic sets both allies free, one of them is revealed to be the Heavy Magician in disguise, who swipes the Ruby and passes it to the broken-down Hard Boiled Heavies, reviving them and sending the heroes back to Green Hill Zone. Thus, the heroes set off to chase the Phantom Ruby on another adventure similar to the first one.
After the Phantom Egg is defeated once again, the heroes are distracted by the Phantom Ruby as it floats there while Eggman sneaks away. The Ruby then goes out of control and creates a space-time rift that begins to suck in everything around it, including the Titanic Monarch. Eggman tries to make an escape, but the heroes escape in their Super forms and knock him into the rift. It is unknown what has happened to the Phantom Ruby afterwards.