#Weird issue. Unity claims class already defined somewhere else when it isnt.

1 messages · Page 1 of 1 (latest)

grand arrow
#

Hey all, Im running into a strange issue where Unity claims my Systems class name is already defined in the namespace. However, i have quadruple checked it is not in the namespace and even tried just changing the name to dumb words. I also tried putting a namespace around the script to try and isolate it, but the error persists. Here is my script

The error is from the ShipInputSystem
`
using Unity.Entities;
using Unity.NetCode;
using UnityEngine;

namespace Ship
{
public struct ShipInput : IInputComponentData
{
public float yaw;
public float throttle;
public float pitch;
public float tilt;
public bool boost;
}

[DisallowMultipleComponent]
public class ShipAuthoring : MonoBehaviour
{
    class Baking : Baker<ShipAuthoring>
    {
        public override void Bake(ShipAuthoring authoring)
        {
            AddComponent<ShipInput>();
        }
    }
}


public class ShipInputSystem : SystemBase
{
    private PlayerControls controls;

    public void OnCreate()
    {
        controls = new PlayerControls();
    }

    protected override void OnUpdate()
    {
        foreach (var playerInput in SystemAPI.Query<RefRW<ShipInput>>())
        {
            playerInput.ValueRW = default;

            playerInput.ValueRW.yaw = controls.Player.Yaw.ReadValue<float>();
            playerInput.ValueRW.throttle = controls.Player.Throttle.ReadValue<float>();
            playerInput.ValueRW.pitch = controls.Player.Pitch.ReadValue<float>();
            playerInput.ValueRW.tilt = controls.Player.Tilt.ReadValue<float>();
            playerInput.ValueRW.boost = controls.Player.Boost.ReadValue<float>() > 0;
        }
    }
}

}`

and here is my error that will not go away regardless of the namespace or name of the ShipInputSystem class (I've tried naming it a bunch of random things like "StupidSystem" "UnityMakesMeMad" etc etc

Unity.Entities.SourceGen.SystemGenerator\Unity.Entities.SourceGen.SystemGenerator.SystemGenerator\Temp\GeneratedCode\Assembly-CSharp\ShipAuthoring__System_12858203020.g.cs(8,18): error CS0101: The namespace 'Ship' already contains a definition for 'ShipInputSystem'

steady mason
#

all systems must be partial

grand arrow
#

Ill try that

#

oh

grand arrow
#

Ig unity's error handler was focused on something else lol, as i've made that mistake before and unity flagged it correctly

#

(RESOLVED) Weird issue. Unity claims class already defined somewhere else when it isnt.

lofty hound
#

(don't put resolved in the title, there is a resolved tag for the post)

grand arrow
#

I'll add the tag ty