Just hours before scoring on a game-defining 83-yard touchdown reception, wide receiver Marquise Goodwin was with his wife, Morgan. The two had just suffered the heartbreaking tragedy of losing their child.

According to a post on Instagram by the receiver, Goodwin's wife had to prematurely deliver their baby boy, who did not survive, around 4 a.m. due to complications.

Goodwin's touchdown was the first of four by the 49ers en route to a 31-21 victory over the New York Giants, which was San Francisco's first win of the season. Goodwin blew a kiss into the sky before crossing the goal line. After the score, he dropped to his knees and wept as his teammates ran over to congratulate him.

49ers head coach Kyle Shanahan spoke to the media on Monday and shared what Goodwin went through over the weekend.

"I haven't talked to Marquise about exactly what he wants to share publicly," Shanahan said, "but he called me Saturday morning before we had meetings and stuff in the morning and walkthroughs -- and he called me knowing he had to be with his wife because they were having some complications with that stuff.

"So, he missed our meetings and stuff Saturday. I'm at the hotel Saturday night when things had gotten better. I believe he got a call late Saturday night that he had to go in and help her out because some of the stuff that she was going through. And then I could out early in the morning on Sunday what had happened. And then I just met him up here, and a few of us talked to him.

"He was struggling with it for obvious reasons. He decided to play, which we were very grateful for. I think 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."

RELATED 49ers-Giants game ball goes to Marquise Goodwin, who played amid tragedy

Shanahan was asked about Goodwin being able to play on Sunday and what says about his character.

"I think every individual is different," Shanahan said. "I've been a coach for a while. I've been with players who have lost one their parents the day before games and stuff. I think everyone reacts differently to that stuff so I don't think you can judge or expect anything. I've had some people who, a death happens, and they can't see anyone. They have to go home right away, and you totally understand that and respect it. I've been around some people who, that happens, and they need to play the next day. They think that's what someone would want and that's very important to them and helps them.

"In my experience, over stuff like that, is you can't judge someone or really anticipate how anyone's going to act. You just try to support them and help them clearly make the best decision for them and their family.

"I know Marquise was hurting bad, real bad, and I know he will for a while. And I know his wife will too. To get him in here, I don't know how sure he was right away because I think he was up long throughout the night and then he got here and Pastor Earl [Smith], who worked with him a lot and comforted him a lot, I think did a great job with him.

"By the time I was able to talk to him, Marquise, he was hurting, but he was adamant he wanted to play. That's something, as a coach, you respect. You don't want someone just to tell it to you because that's what you want to hear as a coach. You want someone to tell it to you because they mean it. You could tell Marquise meant it.

"He helped us out a lot yesterday too. For a guy to go through that, to have those emotions, to go the whole night before really not sleeping very much, and to come out and have some very pivotal plays in that game and make a huge difference, it says a lot about the guy."

Shanahan said he figured the 49ers would be penalized for a delay of game following the touchdown because of how much time Goodwin spent in the end zone.

"Fortunately, the refs gave us a little bit more time than usual," Shanahan said. "So we got the kick off, the extra point, with a second on the clock."