if (transform.GetComponent<InteractableItem>() == null)
{
InteractableItem interactableNaviItem = transform.gameObject.AddComponent<InteractableItem>();
for (int i = 0; i < ikControl.lookObjs.Count; i++)
{
if(ikControl.lookObjs(i).contains)
ikControl.lookObjs.Add(interactableNaviItem);
}
interactableNaviItem.interactableMode = InteractableItem.InteractableMode.ActionWithoutThrow;
interactableNaviItem.distance = 1.7f;
}
At this line there is no contains property :
if(ikControl.lookObjs(i).contains)
The List definition :
public List<InteractableItem> lookObjs = new List<InteractableItem>();
The type is of this class :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System;
public class InteractableItem : MonoBehaviour
{
public string currentMode;
public enum InteractableMode
{
Description,
Action,
ActionWithoutThrow
};
public InteractableMode interactableMode = InteractableMode.Description;
public float distance;
(TextArea(1, 10))
public string description = "";
public bool IsAnyAction()
{
return interactableMode == InteractableMode.ActionWithoutThrow || interactableMode == InteractableMode.Action;
}
public bool IsActionWithoutThrow()
{
return interactableMode == InteractableMode.ActionWithoutThrow;
}
private void Start()
{
currentMode = GetComponent<InteractableItem>().interactableMode.ToString();
}
private void Update()
{
}
}