Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: UltraTM on January 10, 2015, 10:53:01 AM

Title: error CS0029: Cannot implicitly convert type `void' to `UnityEngine.Collider'
Post by: UltraTM on January 10, 2015, 10:53:01 AM
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
Title: Re: error CS0029: Cannot implicitly convert type `void' to `UnityEngine.Collider'
Post by: Nicki on January 10, 2015, 05:48:42 PM
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.  
Title: Re: error CS0029: Cannot implicitly convert type `void' to `UnityEngine.Collider'
Post by: UltraTM on January 11, 2015, 06:26:44 AM
Thank you very much that fixed my Error :)