16
NGUI 3 Support / [SOLVED]UICamera.onClick does not exist...i
« on: December 17, 2014, 02:24:48 PM »
Hi,
I try to set an event delegate but I have the bellow error
Here is my code :
I tried with Onclick and onClick.
I am new to delegate stuff...
I try to set an event delegate but I have the bellow error
- Assets/Libraries/Wizar/UIInteraction/OpenBottomSheet.cs(30,62): error CS1061: Type `UICamera' does not contain a definition for `OnClick' and no extension method `OnClick' of type `UICamera' could be found (are you missing a using directive or an assembly reference?)
Here is my code :
- using UnityEngine;
- using System.Collections;
- using Wizar;
- public class OpenBottomSheet : MonoBehaviour {
- private Transform _tweenTarget;
- private bool _isDisplayed = false;
- public Vector3 hover = Vector3.zero;
- public float duration = 0.2f;
- Vector3 mPos;
- bool mStarted = false;
- void Start(){
- _tweenTarget = transform.GetChild(1);
- if (!mStarted)
- {
- mStarted = true;
- mPos = _tweenTarget.localPosition;
- }
- }
- // Shout that a new bottom sheet is going to be opened
- void OnEnable () {
- MapEventsManager.Trigger("OnOpeningBottomSheet");
- MapEventsManager.OnOpeningBottomSheet += Close;
- UICamera.mainCamera.GetComponent<UICamera>().onClick += Open;
- }
- void OnDisable () {
- MapEventsManager.OnOpeningBottomSheet -= Close;
- UICamera.mainCamera.GetComponent<UICamera>().onClick -= Open;
- }
- void Open(){
- if (!_isDisplayed){
- TweenPosition.Begin(_tweenTarget.gameObject, duration, mPos + pressed).method = UITweener.Method.EaseInOut;
- _isDisplayed = true;
- }
- }
- void Close(){
- if (_isDisplayed){
- TweenPosition.Begin(_tweenTarget.gameObject, duration, mPos).method = UITweener.Method.EaseInOut;
- _isDisplayed = false;
- }
- }
- }
I tried with Onclick and onClick.
I am new to delegate stuff...