← Back to all addons

Rarity Items Badge (3.1)💎💎

Posted by Mr.Titan on Jan 15, 2025 at 11:04 PM

ExperimentalFeature
💡 6

Implement icon for rarity of the items in your game! (No credits needed for the sprite, use as you wish!)

Import assets

  • Import the GradeSheet.cs and the sprite

Code changes

To Item.cs add the following in line ~40:

        [SerializeField] private GradeSheet m_grade = null;
        public GradeSheet grade => m_grade;

To UIInventoryBagSlot.cs and the following lines:

//line ~12
        [SerializeField] private Image m_grade = null;

In SetItem method, inside of the if else statement, add the following lines (dont change anything else, just add this code to it):

//if (item){ 
...
    if (m_grade.enabled = item.grade!=null)
    {
        m_grade.sprite = item.grade.icon;
    }
//else {
    ...
    m_grade.enabled = false;
//}

To UIInventoryEquipmentSlot.cs we will do exactly the same thing has previous task. Add following lines:

On top, in the [SerializeFields], add the following field:

//line ~12
        [SerializeField] private Image m_grade = null;

In SetEquipment method, inside of the if else statement add the following lines (dont change anything else, just add the code there): If statement:


//if (equipment){ ..
    if (m_grade.enabled = equipment.grade!=null)
    {
        m_grade.sprite = equipment.grade.icon;
    }
//}

If statement:

//else {

    ... //add the following:
    m_grade.enabled = false;
//}

Setup The UI

  • Open Equipment Slot prefab, add a Image object named Grade inside Equipment Slot. Ajust position and size. Size i recomend (30,30)
  • Click Equipment Slot and drag the Grade objecto to the Grade parameter.
  • Do all the same for Bag item Slot prefab.

Create Grades

  • Right click in the project go to Create/Mythril2D/Grade/GradeSheet. Create as many as you like, set the grade sprite.

Setup Items Grade

  • Open one item in Database/Items and set the grade.

!Nice gaming!

📜 Scripts

💬 Comments (12)

PITCH CANKER Jan 15, 2025 at 11:06 PM
Damn dude I just finished reading one of your posts and you just immediately flex another upgrade
😆 3
SvanDark Jan 15, 2025 at 11:08 PM
Where should we put the “gradesheet” script, or can we just place it anywhere?
SvanDark Jan 15, 2025 at 11:09 PM
just making sure y’know :p
Mr.Titan Jan 15, 2025 at 11:09 PM
Mr.Titan Jan 15, 2025 at 11:09 PM
I dind mention in the post because ican only write 600 char.
SvanDark Jan 15, 2025 at 11:10 PM
ah, gotcha
Mr.Titan Jan 15, 2025 at 11:10 PM
But i made a folder in Runtime/Scripts/Database/Grade to put the file. And a folder in Demo/Database/Grade for the sheet you generate.
SvanDark Jan 15, 2025 at 11:10 PM
🫡
Mr.Titan Jan 15, 2025 at 11:11 PM
That’s how we roll! The catch is that you guys then really have to finish the game and let me play it! Deal? 😅 🧙♂️
💯 3 👹 1
Gyvr Jan 15, 2025 at 11:17 PM
I’ll finish it twice if that’s all it takes!
❤️ 3 👹 1
Mr.Titan Apr 26, 2025 at 07:21 PM
❤️ 1
Mr.Titan Apr 26, 2025 at 07:21 PM
Rarity Items Badge (3.1)💎💎

Want to continue the conversation?