This is how The answer to stopping Unicron and Thomas meets Primus goes in Thomas' Adventures of Transformers Prime Beast Hunters: Predacons Rising.
Rainbow Dash: How are we suppose to stop Unicron from destroying Primus?
Thomas: Wait! That's it.
Applejack: What's it?
[Thomas has gone]
Pinkie Pie: Where'd he go?
Rarity: We will find out ourselves.
[Thomas, Rainbow Dash, Pinkie Pie, Rarity, Applejack, Fluttershy, Starlight Glimmer, Trixie Lulamoon, Princess Celestia, and Princess Luna go to Primus, Cybertron's core]
Rainbow Dash: Whoa!
Pinkie Pie: That's Primus?!
Rarity: I imagined him bigger.
Applejack: This is him in planet form, Rarity.
Fluttershy: He actually seems kind of nice.
Starlight Glimmer: And giant.
Trixie: And great and powerful if I do say so myself.
Princess Celestia: Impressive.
Princess Luna: Most modest.
Thomas: Primus. I've come back.
Primus: OpThomas. I knew you'd find out that you were a Train-Prime one day. And you brought friends. What are your names little ponies?
Rainbow Dash: I'm Rainbow Dash.
Pinkie Pie: I'm Pinkie Pie.
Rarity: My name is Rarity.
Applejack: Ah'm Applejack.
Fluttershy: I'm Fluttershy.
Starlight Glimmer: I'm Starlight Glimmer.
Trixie: And I am the great and powerful Trrrrrrixie.
Princess Celestia: I am Princess Celestia. Godess of the sun.
Princess Luna: And I am Princess Luna. Princess of the Night.
Primus: It is an honor to meet you, Princess of the Sun and Princess of the Moon.
Princess Celestia: It is a honor to meet you too, uh...
Princess Luna: Great Cybertronian of creation.
Thomas: I have something very urgent I need to warn you about. Your brother, Unicron, has made an army of Terrorcons and is going to use it to destroy you and Cybertron.
Primus: My brother was always filled with a desire for power. OpThomas. You must save Cybertron your own way.
Thomas: Ok. But someone else is helping me with this.
Primus: Who is it be?
Thomas: Ryan F-Freeman.
Primus: The techno-organic who is my student?
Thomas: Yes. And what will happen if Unicron kills me?
Primus: You manage to defeat Unicron alone the first time and the second time with the help of Big Hero 6, despite my brother being able to create weapons out of Dark Energon. But if my brother does kill you, there will be a new Prime to take your place. And that Prime is the one helping Optimus Prime retrieve the Allspark.
Thomas: [gasps] You mean Twilight?!
Thomas: But, Primus. She's just a princess. She's not worthy.
Primus: But one day she will rise from the Autobot's ranks and use the power of the Matrix of Leadership to light our darkest hour and destroy my brother once and for all.
Thomas: Ryan would follow in her hoofsteps. Why you pick Twilight and not Ryan?
Primus: The reason I chose Twilight Sparkle to be the next Prime is because she is a librarian like Orion Pax.
Starlight Glimmer: Who's Orion Pax?
Trixie: Yes. Who is this "Orion Pax" of whom you speak?
Primus: Gather round ponies I'm going to tell you a story. This is the story of how Optimus became a Prime and when Optimus and Megatron were not sworn enemies: Do you recall when Ratchet mentioned that Optimus wasn’t always a Prime? Well, he wasn’t always Optimus either. He was once a clerk in the Iacon Hall of Records named Orion Pax. But as he learned more about Cybertron’s past, he grew increasingly concerned about the present corruption in high places and inequality among the masses. Orion became inspired by the words and ideas of a gladiator, one who had named himself after one of the thirteen original Primes – Megatronus. Megatronus vowed to challenge Cybertron’s leadership and demand that all Cybertronians be treated as equals. This gladiator turned revolutionary rapidly gained a loyal following. Soundwave, chief among them. Orion began corresponding with Megatronus, who came to be something of a mentor to him. As Megatronus left the gladiatorial arena for the political, he saw fit to shorten his name. Before long, Megatron appeared before the High Council to propose his vision for a just society. And it was here that he began to reveal his true colors. Proclaiming the need to overthrow the old guard with force and arrogantly demanding to be named the next Prime. But Orion did not believe in violence as a means of achieving justice. The sparks and minds of the Council were moved by Orion’s words. Here…for the first time since Cybertron’s Golden Age…stood someone worthy of being a Prime. But that honor could only be achieved by earning the legendary Matrix of Leadership. His ambitions thwarted, Megatron spitefully severed all ties with Orion and the Council, and came to wage war on all who opposed him through his growing army of followers which he named Decepticons. He vowed to claim the Matrix for himself wherever it might lie. In time, warfare consumed Cybertron, poisoning the planet to me. Orion journeyed here, hoping to reverse the ill effects and found himself before me. I sensed the innatiability within Orion and bestowed the Matrix upon him. It was thus that a surprised and humbled Orion Pax came to be Optimus, one of the last of the Primes.
Rainbow Dash: Awesome!
Pinkie Pie: Wow!
Rarity: That story is fabulous though long.
Applejack: I can't believe all that happened at once.
Fluttershy: That was a good story.
Starlight Glimmer: Even Megatronus was like how I was before Twilight and her friends taught me about friendship.
Trixie: And me.
Princess Celestia: Most extraordinary.
Princess Luna: Indeed, sister.
Thomas: I remember in the vision that Optimus won't be the last one. But Ryan will be the new Prime.
Primus: I'm sorry Thomas, but I have made my decision: Princess Twilight Sparkle will be the next Prime after your death.
Thomas: Wait. Maybe you can make Ryan and Twilight the next Primes. After my death, you make Ryan AND Twilight the next primes.
Primus: I have to tell the ponies something else. Ponies, this next story is about me and my brother: In the beginning, there was me and there was Unicron. One the incarnation of creation, the other of destruction. For eons, me and Unicron battled. The balance of power shifted between us more times than could be counted. Only by creating, The Thirteen, the original Primes who proceeded Optimus, was I finally able to defeat Unicron, and cast him out. I became one with the very core of the Transformers' planet, Cybertron, creating life through the Well of the Allspark, while Unicron drifted through the cosmos aimlessly. Eventually due to gravitational force, debris from space gathered around the slumbering Titan, forming Planet Earth.
Rainbow Dash: Whoa!
Pinkie Pie: Unicron was the actual creator of Earth?
Rarity: I did not expect to hear that.
Applejack: Ah can't believe it.
Fluttershy: Quite a story.
Starlight Glimmer: Wow!
Trixie: I like it.
Princess Celestia: Even more impress.
Princess Luna: Indeed.
Primus: I also have a legend to you all. This is the Legend of the BIONICLE. In the time before time, the Great Spirit descended from the heavens, carrying the ones called the Matoran, to an island paradise. They were separate and without purpose, so the Great Spirit illuminated them with the three virtues: Unity, Duty, and Destiny. They embraced these gifts, and in gratitude, they named their island home Mata Nui, after the Great Spirit himself. But their happiness was not to last, for Mata Nui's brother, the Makuta, whose real name is Teridax, was jealous of these honors and betrayed him, the Makuta battled and was defeated by Mata Nui, who banished him to one of Cybertron's abandoned moons. The Makuta was free to unleash his shadows and unleash them, he did.
Rainbow Dash: Whoa!
Pinkie Pie: All these stories are staring to build up to something.
Rarity: I couldn't agree more.
Applejack: Ah smell a rat.
Fluttershy: Well, that's nice.
Starlight Glimmer: Makuta has a real name?
Trixie: I thought it was Makuta who puts a spell to make Mata Nui fall into endless sleep.
Princess Celestia: I did not know that.
Princess Luna: Me neither.
[Meanwhile, Ryan is with Sci-Ryan, the Autofruit and the EOI]
Annoying Orange: Ryan. You got any idea how to stop Unicron?
[Ryan thinks of a plan then sees a vision of Ryan seeing Ryalight Glimmer fighting Codylight Sparkle]
[Ryalight uses his magic at his brother]
Codylight Sparkle: You have to stop, Ryan! Twilight will return and she did!
Ryalight Glimmer: Why not? She was my friend and she will be again!!
[Ryan smacks himself ending the vision]
Ryan F-Freeman: Yeah? What is it?
Thomas: You got one of those visions?
Evil Ryan: I can feel Unicron's life force. We could have do something. We need a permanent solution for trapping Unicron, the Allspark vessel.
[Ryan's friends gasps]
Thomas: But, Evil Ryan. Unicron would destroy us all.
Ryan F-Freeman: Not if it's emptied. If Optimus sees me, he would make me a Prime instead of Twilight.
Evil Ryan: Primus. I think Ryan is onto something. If the Allspark vessel is emptied and Ryan give it to your brother, you think Ryan can be a Prime instead of Twilight?
Primus: It is a possibility.
Evil Ryan: Yeah. And when he's in Thomas' Human Adventure where Twilight came back in her body, Ryan will be a Prime and a prince and nothing will stand in our way.
Primus: Yes. I see you have much faith in your friend.
Crash Bandicoot: Yup. Why you have much faith in Ryan, Evil Ryan?
Evil Ryan: Because he's Primus' student. [to Primus] You like Ryan as your student, Primus?