Assistance With Var Casting

Show off your mod creations or just a work in progress.
Post Reply
l3lessed
Posts: 1409
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Assistance With Var Casting

Post by l3lessed »

I'm having an issue with casting this Enum var to a new empty var. I'm getting the implicitly casting error, but I can't understand why. I think I'm casting it explicitly. Here's the code, if someone can help me understand this.

Here is the basic casting error:
Assets\Game\Mods\Minimap\Scripts\BuildingManager.cs(577,43): error CS0266: Cannot implicitly convert type 'Minimap.MarkerGroups [D:\Games\daggerfall-unity-master\Assets\Game\Mods\Minimap\Scripts\Minimap.cs(24)]' to 'Minimap.MarkerGroups [D:\Games\daggerfall-unity-master\Library\ScriptAssemblies\Assembly-CSharp.dll]'. An explicit conversion exists (are you missing a cast?)
This is the line causing the issue. MarkerGroupID variable is the integer conversion for the enum MarkerGroups value being assigned.

Code: Select all

                MeshController meshScript = combinedMesh.AddComponent<MeshController>();
                meshScript.buildingType = (MarkerGroups)markerGroupID;
This is the var being setup in the Meshcontroller script, which it is assigning/casting to.

Code: Select all

public MarkerGroups buildingType = new MarkerGroups();
Here is the public enum it is using to cast from

Code: Select all

public enum MarkerGroups
{
    Shops,
    Blacksmiths,
    Houses,
    Taverns,
    Utilities,
    Government,
    Friendlies,
    Enemies,
    Resident,
    Doors,
    None
}
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply