C# Challenge 2

Xavier Hadley
2 min readJul 18, 2023

--

C# Survival Guide Challenge 2:

/// summary

/// Every item has a name, description, image icon, and attack strength

/// figure out how to add a sprite image to the variable

///</summary>

I overthought this one hard.
It was just a string for the name of the weapon and the description. An int for the damage value and then when I looked up the image I found out I can just use public Image then name it and I can select a file for the image later. I got caught up trying to figure out how to add a damage range for the weapon damage and in my confusion I forgot how to Debug correctly. Once I figured it out it generated correctly. Debug.Log(describe what you want to show and use + inbetween different items. strings must have “” and variables must be types in the correct casing)

I created a cylinder then changed the position and proportions. Then I added the Item.cs script to the components in the Inspector before playing the game and checking the console to verify it worked successfully.

I added an image from the UI and tested it.

--

--

Xavier Hadley

A passionate and driven C# and Unity developer. Committed to creating games that blend the culture of people with technology.