Invisible custom SharedVariable in the Inspector

ASerg3v

New member
Hello Colleagues,

I've created a custom SharedVariable and I would like to edit the value via the inspector, however, the inspector does not display its name until a right button is pressed.
Is it a bug ?

1675007030722.png

See some code I use:

[System.Serializable]
public class SharedUnitTask : SharedVariable<UnitTask>
{
public static implicit operator SharedUnitTask(UnitTask
value) { return new SharedUnitTask { mValue = value }; }
}

[TaskCategory("Npc/Unit Task")]
public class MatchesUnitTask : Conditional
{
public SharedUnitTask givenTask;
public SharedUnitTask expectedUnitTaskType;

public override TaskStatus OnUpdate()
{
return TaskStatus.Success;
}
}
 
What is UnitTask? My guess is that it doesn't have any serializable fields so that's why no fields show.

Not displaying the name until you press the button is the correct behavior as until that point the variable isn't shared with other tasks.
 
Oh, I see... UnitTask is a simple class without any inheritance like Monobehavior or ScriptableObject. So it cannot have a reference like SharedGameObject has.

Sorry for bothering you!
 
Top