Kyle Shanahan would have understood if Marquise Goodwin didn't want to play against the Giants.
Shanahan, who's been coaching in the NFL for 14 seasons, has seen players lose loved ones in days leading up to games and knows the mental weight it can carry.
The 49ers coach was ready to let his speedy receiver take time with his wife after she prematurely gave birth to their son, who then died of complications hours before their game on Monday.
But Goodwin decided to play, helping San Francisco get its first win of the season. He had an 83-yard touchdown reception and threw a key block on another big scoring play, when he laid out a defensive back and allowed Garrett Celek to scamper into the end zone.
Goodwin later announced his family's loss on social media.
"By the time I was able to talk to Marquise, he was hurting but he was adamant he wanted to play," Shanahan said Monday.
"For a guy to go through that, to have those emotions, to go the whole night before and really not sleeping very much and come out there and have some very pivotal plays in that game, and make a huge difference, it says a lot about the guy.
"Regardless of whether he played good or bad, the fact that he was out there and trying his hardest and trying to help was the most important."
Shanahan said he first knew about the situation the morning before the game, when Goodwin told him that his wife, Morgan, was experiencing complications with the pregnancy. Shanahan allowed Goodwin to be with her that night and then heard about the news the following morning before the game.
"He was struggling with it for obvious reasons and he decided to play, which we were very grateful for," Shanahan said.
"He did a hell of a job for his wife yesterday, being there for her and helped out his family from that aspect. And also helped out his family here too. I think he helped out every side and was pretty impressive yesterday."
Goodwin was clearly emotional while scoring the long touchdown Sunday. He blew a kiss toward the sky as he crossed the goal line before falling to his knees in the end zone. Teammates on the field, and some from the sideline, ran to lift him back to his feet and show support.
The 49ers beat the New York Giants 31-21 to win the match.