In handing out millions of dollars to 20 Chicago public schools on Friday, Chance the Rapper took a serious tone, saying that even he’s not immune from the city’s violence, indicating that people have threatened to shoot him — not once, but twice — in the past two months.

While the Grammy-winning rapper dismissed the threats as “just talk,” he talked about the sense of “unease” on some Chicago streets, clearly trying to show that education is a key to helping the city’s young people escape the cycle of violence that mires some neighborhoods.

“Twice, just in the months I’ve been back from tour, I’ve had someone tell me they were going to shoot me,” Chance said Friday to a stunned crowd at the Harold Washington Cultural Center in Bronzeville. “It was obviously just talk. Both were small altercations.

“But, honestly, immediately in both situations, I could tell at the first point of contact, that these two young people had a chip on their shoulder. They felt under-appreciated, undervalued or cheated. . . .

“Here in Chicago, in the summers when the city is the most beautiful . . . there’s still this undercurrent of something ominous, there’s this unease . . . a climate of fear.”

Then, sensing the effect he was having on the crowd, Chance lightened the mood. “Obviously I’m killing this, right?” he said, drawing laughter and saying he was going off-stage for a do-over.

The Jones College Prep alum, whose given name is Chancelor Bennett, returned minutes later to announce details of raising more than $2.2 million for 20 schools across Chicago through his charity, SocialWorks. The donation follows Chance’s other acts of charity this year. At the Bud Billiken Parade on Aug. 12, SocialWorks handed out 30,000 backpacks. The backpack giveaway followed cash donations to CPS through SocialWorks in March.

Chance’s second take in presenting the cash included discussion of his young daughter, whom he’s thinking about sending to preschool. “These are the two most pressing things on my mind — the thought of finally sending my daughter to school, and the unease of the city she’s entering into,” Chance said.

Each of the 20 schools will get a total of $100,000 over the next three years. Funds will be held by a non-profit that raises money for CPS, the Children First Fund, and principals will submit requests for purchases through that organization.

Chance The Rapper announces a $2.2 million donation from SocialWorks to Chicago Public Schools during a presentation at Harold Washington Cultural Center in the Bronzeville neighborhood, Friday, Sept. 1, 2017. | Ashlee Rezin/Sun-Times

Principals were notified of the cash awards last month and were tasked with creating or expanding programs that are meaningful to students. Those programs include theater, dance, digital arts, ceramics, graphic arts and more.

For Althea Hammond, principal of Ambrose Plamondon Elementary, the funds that her school will receive will help expose students to different subjects. The school plans to open a science lab and will also put the Dr. Seuss-based “Seussical,” a production that wouldn’t have been possible without Chance, Hammond said.

“If I could put a blessing into words I would say that this is going to bring a sense of opportunity, a sense of hope,” Hammond said. “Black and brown kids aren’t often steered toward math or science, so this is a sign that they can be the next engineer, the next doctor, the next actor or producer. I thank Chance for giving us a chance.”

Chance inserted himself to the debate over public-school funding in Illinois earlier this year, even meeting with Gov. Bruce Rauner about the issue. State lawmakers finally resolved the matter this week, with Rauner signing a comprehensive school-funding reform plan into law.