#Solving PlayerInput Error

1 messages · Page 1 of 1 (latest)

rapid wedge
#

Hi there,
I'm doing a tutorial series to learn how to make an on-rails shooter to protoype some ideas. The tutorial is a few years old, but I'm on Unity 6000.1.12f1.
Tutorial (Stuck on Part 2): https://www.youtube.com/watch?v=-sbBkRrVQZg&list=PLnJJ5frTPwROHmPx61qjFk9BBYczWt-Nu&index=3

I'm stuck on the second video because I can't seem to get my ship to aim and I've messed around my code for answers so much that for whatever reason I can no longer move my ship around like I previously could either. I'm looking at my console for clues, but the only thing I see is the following error:

UnityEngine.Debug:LogError (object,UnityEngine.Object)
KBCore.Refs.SceneRefAttributeValidator:ValidateRef (KBCore.Refs.SceneRefAttribute,UnityEngine.Component,System.Reflection.FieldInfo,object) (at ./Library/PackageCache/com.kylewbanks.scenerefattribute@8d3a0ee42158/SceneRefAttributeValidator.cs:442)
KBCore.Refs.SceneRefAttributeValidator:Validate (UnityEngine.Component,System.Collections.Generic.IList`1<KBCore.Refs.ReflectionUtil/AttributedField`1<KBCore.Refs.SceneRefAttribute>>,bool) (at ./Library/PackageCache/com.kylewbanks.scenerefattribute@8d3a0ee42158/SceneRefAttributeValidator.cs:186)
KBCore.Refs.SceneRefAttributeValidator:Validate (UnityEngine.Component,bool) (at ./Library/PackageCache/com.kylewbanks.scenerefattribute@8d3a0ee42158/SceneRefAttributeValidator.cs:120)
KBCore.Refs.SceneRefAttributeValidator:ValidateRefs (UnityEngine.Component,bool) (at ./Library/PackageCache/com.kylewbanks.scenerefattribute@8d3a0ee42158/SceneRefAttributeValidator.cs:105)
RailShooter.InputReader:OnValidate () (at Assets/Settings/InputReader.cs:35)*```

Double clicking this error doesn't take me to my InputReader Script, but rather a random script in a document called SceneRefAttributeEditor.cs to the line saying: ```Debug.LogError($"{c.GetType().Name} missing required {elementType?.Name + (isCollection ? "[]" : "")} ref '{field.Name}'", c.gameObject);```
I haven't touched this as I don't know what it's talking about.

I've attached the InputReader and WeaponSystem scripts I'm working with. I was experimenting using CoPilot for the first time tonight to fix up any errors or fix any code I copied from the tutorial that for some reason didn't work, so somethings may be wrong though I tried to copy and correct it as best as I could. If someone could help me get a handle on this, I'd greatly appreciate it as it's holding me up a lot and I've had this problem for a while. Also, please explain this clearly if you figure out what is wrong, I am an artist and intermediate coder who doesn't code often, not an advanced programmer.

Note: That the KB Core stuff is based on some library imported in the first video. The above link is a playlist link, so you can navigate to that if you need to for info.

Shooting straight ahead is boring! Let the Player Aim and Shoot while moving along the rail in this second episode of our Rail Shooter Game Development Series. We're going to use some smoke and mirrors, invisible to the player, to create a unique and very FUN aiming system that looks good and feels good.

🔔 Subscribe for more Unity Tutorial...

▶ Play video
autumn sand
#

please share your code properly

#

!code

wary helmBOT
autumn sand
#

it seems pretty straightforward though

#

your inputreader doesn't have the PlayerInput assigned

#

have you done so?

rapid wedge
#

But where do I put that and how

#

I tried looking it up but nothing I've tried has worked

autumn sand
rapid wedge
#

I cannot tell what is incorrect here

autumn sand
rapid wedge
#

No and that's also what confuses me. The inspector offers no slots to put anything in.

#

Because I figured I would do that, but there are no options

rapid wedge
autumn sand
rapid wedge
autumn sand
rapid wedge
#

Yes, this is an issue I've had for days.

autumn sand
#

do other components have visible fields?

rapid wedge
#

Nope, not on Input reader

#

See above screenshot

autumn sand
#

i asked about other components

#

does this issue affect other components

rapid wedge
#

You mean the other scripts? Yes they do.

#

I can assign things on the other scripts just fine

autumn sand
#

might be that there's a custom inspector for this component that's not working correctly

rapid wedge
autumn sand
#

try setting the inspector to debug mode

#

oh you're aslo getting the playerinput on Awake

#

not sure why your playerinput is serialized then

#

you're missing a PlayerInput component entirely

#

(though, the missing inspector fields is still an issue)

rapid wedge
#

Okay, NOW I see something on DebugMode, but I still can't seem to edit anything in that script.

autumn sand
#

whatever Self is, seems to be disabling assigning to that field?

#

going off the other components

autumn sand
rapid wedge
#

Okay, where would I put that in the code and how?

autumn sand
#

you would not

#

you would put a playerinput component on this object

rapid wedge
#

I do have that on the game object

autumn sand
#

could you show that then

rapid wedge
autumn sand
#

and it's on the same gameobject?

rapid wedge
#

Yep

autumn sand
#

just as a sanity check, try hovering over the PlayerInput type in InputReader, make sure it's the one from InputSystem and not one defined in RailShooter

#

well i suppose OnValidate would be running before Awake.

rapid wedge
#

Yep, it's pointing to itself when I check

#

In debug mode

autumn sand
#

oh yeah it is assigned there

#

is that console error new/persistent?

rapid wedge
#

Yep on start

autumn sand
#

maybe it's just an old error?

rapid wedge
#

Before, I could use WASD to move the ship a bit, but now I can't. I must've broke something when I tried to fix it

autumn sand
#

is the playerinputactions set as the default input actions asset?

rapid wedge
#

How would I check that

autumn sand
#

i believe it would be in input system settings

#

if it is, then it should be enabled by default.
if not, then you'd have to enable it yourself

rapid wedge
#

This thing?

autumn sand
#

yeah

#

so yeah you don't seem to be enabling the inputactions anywhere, that could be it

rapid wedge
#

YEP! That did it! Things are kinda working now and the error is gone. Thanks

autumn sand
#

i don't think this would be related to the error actually

rapid wedge
#

Oh

autumn sand
#

i suspect it's just something weird with the validatedmonobehaviour and the Self attribute

#

those aren't unity built-ins

rapid wedge
#

Things are working again, BUT the error is still here afterall

rapid wedge
autumn sand
#

no clue

#

try hovering over them

#

they should show what namespace they're from

rapid wedge