Can not access an abstract class from another script!
I have an abstract class declared on a script :
public abstract class Controller : MonoBehaviour
{
public Sprite ContentType;
public string ContentName;
public string PanelInfoType;
public static string baseUrlAndroid = "link";
public static string baseUrlIOS = "link/";
public CanvasPhoto PassAuthorInfo;
public TrackingEvent OnTrackFoundEvent;
public UnityEvent OnTrackLostEvent;
public abstract void TrackFound(string TrackableName);
public abstract void TrackLost();
}
and i can not declare
public Controller Controller
on another script called DefaultHandler it gives me errors like:
" DefaultHandler' does not contain a definition for Controller' and no extension method Controller' of type DefaultHandler' could be found. Are you missing an assembly reference? "
using UnityEngine;
using Vuforia;
public class DefaultTrackableEventHandler : MonoBehaviour, ITrackableEventHandler{
protected TrackableBehaviour mTrackableBehaviour;
protected TrackableBehaviour.Status m_PreviousStatus;
protected TrackableBehaviour.Status m_NewStatus;
*
*
*
}
The error thrown is in a script called DataSetLoader :
DefaultTrackableEventHandler defaultTr = tb.gameObject.GetComponent();
tr.SetPosition = tb.gameObject.GetComponent();
defaultTr.Controller = tr; // this is the line where the error
and the error in the console is :
Assets/Scripts/DatasetLoader.cs(550,31): error CS1061: Type DefaultTrackableEventHandler' does
not contain a definition for Controller' and no extension method Controller' of type
DefaultTrackableEventHandler' could be found. Are you missing an assembly reference?
This worked fine, after i upgradet Unity and vuforia this error kept appearing. I m using Unity2018.4.3 and vuforia 8.1.11
Can someone please help me understanding why this error appered?
Thank you
According to the given script, you clearly haven't declared any variable / property called Controller
in your class DefaultTrackableEventHandler
, so obviously, you get the error.....
I try to declare it.. but it does not recognise it :
public Controller controller;
it gives error on Controller,
before it didnt @Hellium
public class DefaultTrackableEventHandler : $$anonymous$$onoBehaviour, ITrackableEventHandler{
protected TrackableBehaviour mTrackableBehaviour;
protected TrackableBehaviour.Status m_PreviousStatus;
protected TrackableBehaviour.Status m_NewStatus;
public Controller controller;
}
Should not give any error. If so, please, copy-paste the stacktrace of the error thrown by the compiler.
Your answer
Follow this Question
Related Questions
Can not access opencv webcam script for use in another script 1 Answer
Microsoft Access Database Unity 0 Answers
Child class cannot access property in method? 1 Answer
I cant access a script that I made in Assets/Scripts from the FirstPersonCharacter script. 1 Answer
Multiple PowerUps (One ItemBox) 0 Answers