Question by
unity10000 · Mar 06, 2018 at 02:12 PM ·
error-messagegame objects
how do i fix error code in compiler
I have a script to open and close draw for model in unity 3d. when i build its successful but when i add script to game object it says (cannot add script, fix compile errors before creating new script components) below is the script i am using and error message.
using UnityEngine; using System.Collections;
public class InteractiveObject : MonoBehaviour {
[SerializeField] private Vector3 openPosition, closedPosition;
[SerializeField] private float animationTime;
[SerializeField] private bool isOpen = false;
[SerializeField] private MovementType movementType;
private enum MovementType {Slide, Rotate};
private Hashtable iTweenArgs;
private AudioSource aSource;
void Start () {
iTweenArgs = iTweenArgs.Hash();
iTweenArgs.Add("position", openPosition);
iTweenArgs.Add("time", animationTime);
iTweenArgs.Add("islocal", true);
aSource = GetComponent<AudioSource>();
}
public void PerformAction () {
if (aSource) {
aSource.Play();
}
if (Input.GetKeyDown(KeyCode.E)) {
if (isOpen) {
iTweenArgs["position"] = closedPosition;
iTweenArgs["rotation"] = closedPosition;
} else {
iTweenArgs["position"] = openPosition;
iTweenArgs["rotation"] = openPosition;
}
isOpen = !isOpen;
switch (movementType) {
case MovementType.Slide:
break;}
}
}
}
Assets/SCRIPTS/InteractiveObject.cs(19,33): error CS1061: Type System.Collections.Hashtable' does not contain a definition for
Hash' and no extension method Hash' of type
System.Collections.Hashtable' could be found. Are you missing an assembly reference?
Comment