Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.34k stars 351 forks source link

add DOTWEEN_ASMDEF global marco #686

Open TylerTemp opened 3 months ago

TylerTemp commented 3 months ago

This PR is created to resolve the dependency issue when DOTween is an optional dependence of a package.

Because DOTween is not a package, a standard package can not directly use DOTween.

A common approach for a standard package to optionally depend on DOTween is:

  1. in ASMDEF of the the package itself - Assembly References, add DOTween.dll

    image

  2. because DOTween has no package.json, skip the Version Defines here

  3. use marco DOTWEEN to optionally execute logic with DoTween:

    #if DOTWEEN
    using DG.Tweening;
    // other logic
    #endif

Here using DG.Tweening; will failed when DOTween's ASMDEF has not been created yet, which requires user to manually create that.

Propose

This PR add DOTWEEN_ASMDEF when user created the ASMDEF of DOTween, and a standard package can now optionally depend on DOTween with the same approach, but change:

#if DOTWEEN

to

#if DOTWEEN_ASMDEF

This PR is created because the #586 has been pending for two years. This PR is much much more simple than 586. Though it does not directly resolve the package problem of DOTween, but it allows DOTween to be optionally dependent by other packages right away, with much less time to review the changes I've made