Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Customizing the Metadata script

Discussion in 'Unity Reflect' started by DriesVrBase, Aug 24, 2021.

  1. DriesVrBase

    DriesVrBase

    Joined:
    Mar 24, 2020
    Posts:
    52
    Hi,

    I'm currently working on a tool to view some buildings.
    I want to extend the Metadata class so I can add some more tools to the script.
    For instance I have a 'ChangeParameter' function that searches for a key in the metadata script and you have to pass along a certain string value, this function then changes the value from the key you passed along, to the desired value you entered somewhere else.
    But once I change the Metadata script and let it recompile in Unity it just sets it back to the original script. (because it is in the reflect namespace/package probably).

    Is there a way to turn this off? Or do I need to create a new script that copies the metadata to a new dict and then use this script to alter everything? Seems like a lot of work for a small change so I was wondering if there is an easier way.

    Kind regards,
    Dries
     
  2. DavidMenard

    DavidMenard

    Unity Technologies

    Joined:
    Jun 3, 2019
    Posts:
    108
    Hey Dries!
    I'm by no means an expert on this, so I'll try and help the best I can. This is pretty much how packages will behave throughout Unity, not just Reflect, so that things stay up-to-date and consistent.
    The way around this is to embed a copy of the package in you project, then remove the dependency in Package Manger. This can be done by looking in your Library/PackageCache folder and just grabbing the package you want to change from there.

    Hope this helps!
    David
     
    DriesVrBase likes this.
  3. DriesVrBase

    DriesVrBase

    Joined:
    Mar 24, 2020
    Posts:
    52
    Hi David,

    Thanks for the help! I tried it yesterday already by making a copy, removing the package from the package manager and then selecting 'upload package from disk'. That did the trick :)

    Thanks again!