Forum begins after the advertisement:


[Part 15] How do I change the description and name when I level up?

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity [Part 15] How do I change the description and name when I level up?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #18324
    Stick
    Level 1
    Participant
    Helpful?
    Up
    0
    ::

    Please tell me how I can change the text in this window that appears when the level increases. I used to just change the Objects – Weapons – Knife Weapon in the Scriptable inspector (as an example), but after part 15 it doesn’t work (

    https://imgfoto.host/i/hcb7zR – This is now, nothing is changing

    https://imgfoto.host/i/hcnx5l – It used to be, everything was changing

    #18325
    Alp Apustaja
    Level 8
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    It sounds like you’re facing an issue with updating the text in your game when the level increases. Since you mentioned that it used to work but stopped after a specific part, here are some troubleshooting steps you can take:

    1. Check Scriptable Object References: Ensure that your Scriptable Objects are still properly referenced in your code. If the reference is missing or broken, changes made in the inspector won’t affect the game.

    2. Inspect Level Up Logic: Review the part of your code that handles the level-up event. Make sure that it is still correctly accessing the text properties of your Scriptable Objects. If there have been any changes to how levels or weapons are managed, that could affect this.

    3. Debugging: Add debug logs in your level-up function to print out the text values being assigned. This can help you identify if the correct values are being fetched from the Scriptable Objects.

      Debug.Log("Current Weapon Name: " + weaponName);
    4. Prefab/Scriptable Object Updates: If you are using prefabs or instances of Scriptable Objects, ensure that you’re updating the correct instance. Sometimes changes made to a prefab or Scriptable Object won’t reflect if you’re using an instance that hasn’t been updated.

    5. Check for Overriding Values: Make sure that there are no other scripts or settings that might be overriding the values you are trying to change. Look for any other components that might be modifying the same text field after you set it.

    6. Review Recent Changes: Since you mentioned this issue started after part 15, review any changes made in that part. There could be a new piece of code that affects how the level-up event is processed.

    7. Unity Console Errors: Check the Unity console for any errors or warnings that might indicate what’s going wrong. Addressing these can often resolve unexpected behavior.

    If you can provide more specific code snippets or details about how your level-up logic is structured, I can give you more targeted advice!

    #18327
    Terence
    Level 31
    Keymaster
    Helpful?
    Up
    0
    ::

    Can you share your weapon scripts and the UIUpgradeWindow script?

    #18329
    Stick
    Level 1
    Participant
    Helpful?
    Up
    0
    ::

    A little later, but can you tell me where to change the description of the weapon? Is that where I changed it at the inspector or elsewhere?

    #18330
    Alp Apustaja
    Level 8
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Based on the reference information provided, you should modify the description in this specific line of code:

    upgradeOption.upgradeDescriptionDisplay.text = chosenWeaponUpgrade.weaponData.NextLevelPrefab.GetComponent().weaponData.Description;

    This suggests that the description is now being pulled dynamically from the WeaponController component, rather than just from the Scriptable Object inspector as you did previously.

    #18331
    Stick
    Level 1
    Participant
    Helpful?
    Up
    0
    ::

    I downloaded your project from part 19 and am trying to change the description of the weapon. I didn’t change the scripts or anything.

    #18332
    Alp Apustaja
    Level 8
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Could you clarify exactly where you’re trying to change the weapon description? In the Scriptable Object inspector, or somewhere else in the project?

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: