Closed laurentopia closed 2 months ago
Hi,
seems like MCUnit
is not a Component (usu. a MonoBehaviour).
Here is what I tested on Unity 2022.2 with UI Toolkit:
// MCUnit.cs
public class MCUnit : MonoBehaviour
{
}
// Issue41GetComp.cs
public class Issue41GetComp : MonoBehaviour
{
[GetComponent] [GetComponentInParent] public MCUnit mcUnit;
}
Example of geting it from self:
from parent:
Can you give a small example of how MCUnit
look like?
It's solved and ... I don't remember what I did 🗡️ Here is MCUnit
using System.Collections.Generic;
using SaintsField;
using SaintsField.Playa;
using Panda;
using UnityEngine.AI;
using Vertx.Debugging;
using Gizmos = UnityEngine.Gizmos;
using Random = UnityEngine.Random;
#if UNITY_EDITOR
#endif
#pragma warning disable 0649
public enum Team { ENEMY = 0, PLAYER = 1 }
public class MCUnit : MonoBehaviour
{
[GetComponent]
public MCAttackSelector attackSelector;
[GetComponent]
public AnimationController anim;
public float detectionRange = 100;
public int score = 0,
threat = 1;
public Team team = Team.ENEMY;
public LayerMask enemyLayer,
friendLayer;
public bool noPanda;
[SepTitle(EColor.Violet)]
[SerializeField]
float health = 10.0f;```
Hi, this issue is closed as no feature actions required. If you still have related issue, please comment below and I'll open it again
Because this is causing that