Answered step by step
Verified Expert Solution
Question
1 Approved Answer
unity/c# question: NullReferenceException: Object reference not set to an instance of an object Deck.AddPips (.Card card) (at Assets/__Scripts/Deck.cs:239) what is this error and how can
unity/c# question:
NullReferenceException: Object reference not set to an instance of an object
Deck.AddPips (.Card card) (at Assets/__Scripts/Deck.cs:239)
what is this error and how can I fix it?
private void AddPips (Card card) For each of the pips in the definition... foreach( Decorator pip in card.def.pips) ...Instantiate a Sprite GameObject tG0 = Instantiate ( prefabSprite ) as GameObject; /1 Set the parent to be the card GameObject tG0.transform.SetParent( card.transform) // Set the position to that specified in the XML // Flip it if necessary if (pip.flip) tGO. transform. rotation Quaternion. Euler(0,0, 180); /1 Scale it if necessary (only for the Ace) if (pip . scale != 1) { tGO.transform .loca Scale = Vector3 . one * pp. Scale; // Give this GameObject a name tG0.name"pip" // Get the SpriteRenderer Component tSR_tG0.GetComponentStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started