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. Dismiss Notice

.asmref conditional disable

Discussion in 'Scripting' started by Romaleks360, Jul 6, 2022.

  1. Romaleks360

    Romaleks360

    Joined:
    Sep 9, 2017
    Posts:
    69
    I want to extend some 3rd-party package. asmref works fine, but only when target package exists in project.
    I want to dynamically enable/disable my extension based on the package presence, just like with Version Defines in asmdef. Why there's no such thing for .asmref?
     
  2. Romaleks360

    Romaleks360

    Joined:
    Sep 9, 2017
    Posts:
    69
    Isn't there a way to achieve this?
    I can't use asmdef, because I am extending a 3rd-party partial class, so my extension has to be inside a 3rd-party assembly.

    Literally any asmref will become useless if no target assembly exists. Now this will result in a compiler error. Why doesn't unity disable this invalid assembly automatically? Any way to disable this manually instead of deleting the whole extension? Am I missing something?