0

I'm working on the Unity project now and have an error message in VSCode.

'Transform' does not contain a definition for 'DOMove' and the best extension method overload 'DOTweenModulePhysics2D.DOMove(Rigidbody2D, Vector2, float, bool)' requires a receiver of type 'Rigidbody2D'

using DG.Tweening;
using UnityEngine;

public class Mover : MonoBehaviour
{
    void Start()
    {
        this.gameObject.transform.DOMove(new Vector3(1,2,3), 1);
    }
}

When I type DOMove in VSCode, the auto-completion for that method does not show up. I tried moving the Demigiant folder from plugins into the main asset directory then moved it back and restarted Unity, but I still get the same error...

Yuuu
  • 715
  • 1
  • 9
  • 32
  • Have you installed "Debugger for Unity" extension in your VSCode? – joantoh Jul 27 '21 at 18:15
  • joantoh, I have the same problem. The code compiles and works but VSCode doesn't recognize DOTween, making it hard to write code. Any idea how to work around it? – babibo Dec 29 '21 at 05:05

3 Answers3

5

Do you have a using DG.Tweening; at the top of your file?

If you are using assembly definitions, you need to add "DOTween-modules" as a dependency. Otherwise the using line will not compile.

hk1ll3r
  • 811
  • 1
  • 6
  • 14
  • How can I do that? When I install DOTween, it does not come with any asmdef files. – Ben Dec 23 '22 at 16:10
  • 1
    Ah, you have to open the Dialog it shows at the start, and then select Create ASMDEF. – Ben Dec 23 '22 at 16:18
1

did u already add using DG.Tweening at the file? if yes try open 'edit > preferences > external tools' then change the "external script editor" to "visual studio code". "Regenerate project files" will be appear then click it. That worked for me

kyoizu
  • 11
  • 2
0

I delete another plugin's Assembly script. Than fixed.

(Plugin was: MAST)

ertbaran
  • 31
  • 4