Author Topic: error CS0029: Cannot implicitly convert type `void' to `UnityEngine.Collider'  (Read 4129 times)

UltraTM

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Hello,

i hope someone could help. I bought an Asset which has no support anymore cause no one answers :(
Hope someone could help fixing the Error:

UIDimmer.cs(55,33): error CS0029: Cannot implicitly convert type `void' to `UnityEngine.Collider'


line 55 is : mCol = NGUITools.AddWidgetCollider(gameObject);

Added file as Attachment

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
NGUITools.AddWidgetCollider doesn't return a collider anymore because of the optional 2d colliders instead. You just have to grab the collider yourself like so:

Change the lines

  1. mCol = NGUITools.AddWidgetCollider(gameObject);
  2. mCol.enabled = true;

to

  1. NGUITools.AddWidgetCollider(gameObject);
  2. mCol = GetComponent<Collider>();
  3. mCol.enabled = true;
  4.  

UltraTM

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Thank you very much that fixed my Error :)