Hi
I bought Unitz assets and I used this tutorial http://www.hardworkerstudio.com/unitz/?p=183
When I done everything I got this error
Assets/CNControls/Scripts/CNTouchpad.cs(6,27): error CS0246: The type or namespace name `CNAbstractController’ could not be found. Are you missing a using directive or an assembly reference?
Code of this file:
using UnityEngine;
using CnControls;
///
/// Touchpad control. Much like in Dead Trigger 2 or Shadowgun
///
public class CNTouchpad : CNAbstractController
{
// -------------------------
// Editor visible properties
// -------------------------
///
/// Set to true if you wan’t to fully control the speed of the drag
/// It will feel more responsive if set to FALSE
///
public bool IsAlwaysNormalized { get { return _isAlwaysNormalized; } set { _isAlwaysNormalized = value; } }
// Serialized fields
[SerializeField]
[HideInInspector]
private bool _isAlwaysNormalized = true;
/// <summary>
/// To find touch movement delta we need to store previous touch position
/// It's stored in world coordinates to provide resolution invariance
/// since different mobile devices have different DPI
/// </summary>
public Vector3 PreviousPosition { get; set; }
// i have modified this
public bool OnTouch = false;
public bool OnRelease = false;
bool lastTouch = false;
/// <summary>
/// Good old Update method where all the magic happens
/// </summary>
protected virtual void Update()
{
// If we tweaked, we return and don't check for other touches
if (TweakIfNeeded())
return;
// If we didn't tweak, we try to capture any touch
Touch currentTouch;
OnRelease = false;
OnTouch = IsTouchCaptured(out currentTouch);
if(!OnTouch && lastTouch){
OnRelease = true;
}
lastTouch = OnTouch;
// Setting our initial "previous" position
PreviousPosition = ParentCamera.ScreenToWorldPoint(currentTouch.position);
}
/// <summary>
/// Automatically called by TweakIfNeeded
/// </summary>
/// <param name="touchPosition">Touch position in screen pixels</param>
protected override void TweakControl(Vector2 touchPosition)
{
Vector3 worldPosition = ParentCamera.ScreenToWorldPoint(touchPosition);
Vector3 difference = worldPosition - PreviousPosition;
if (IsAlwaysNormalized)
difference.Normalize();
CurrentAxisValues = difference;
OnControllerMoved(difference);
PreviousPosition = worldPosition;
}
}
Thank you for help
Best regards