#No argument for required parameter (baseValue) of Features.Features(float)

1 messages · Page 1 of 1 (latest)

shadow moat
#

Ok, what is "Features"

#

because the error is telling me that Features requires a float parameter

stuck geode
#

I've been following Kryzarel's tutorials

shadow moat
#

um, maybe you need a baseValue in your Ambition class

stuck geode
#

I thought the 'BaseValue' declaration in Awake was providing that float...

#

but apparently not

shadow moat
#

try adding public float baseValue to the ambition class

#

i'm gonna be honest with you i've never seen a parameter be required for a subclass

stuck geode
#

yeah, it's confounding me - no dice on the baseValue bit

shadow moat
stuck geode
#

yeah, I just tried that

shadow moat
#

is this a runtime error or compiler error

#

what happens when you right click the highlighted part and press suggestions

stuck geode
#

I only get a reference to the error code, and the page it links to has no idea what to do about it

#

I don't get suggestions

shadow moat
#

ok this is a longshot, but have you tried putting a ((float)) after Features

stuck geode
#

unexpected argument list XD

shadow moat
#

you said you're following a tutorial, right?

stuck geode
#

it's a ponderable - thanks for your suggestions, at least
yeah - I haven't quite finished the third video yet, but I've watched them before & I don't think there will be any more information in this regard

#

one moment....

shadow moat
#

one sec

#

: base (float baseValue)
try adding that after public Features(float baseValue) in Features class

#

@stuck geode

stuck geode
#

nope - that just makes a mess; sorry

shadow moat
#

damnit

stuck geode
#

nevermind - I'll ponder it with the help of google; something might gel

#

thanks again for your suggestions

shadow moat
#

i'm so confused

stuck geode
#

me too - it's the only error I've got in all the scripts I've nutted out

#

'scuse the crass

shadow moat
#

i've been trying to understand this

#

because I rarely ever use constructors

stuck geode
#

yeah - I've been staring at that

#

and others

shadow moat
#

You probably did something wrong when making the constructor but I dont know what

stuck geode
#

not yet - I've followed the tutorials all but to the letter

#

but yeah - I may have

shadow moat
#

and your code is IDENTICAL?

stuck geode
#

not identical, but near enough as damn it

shadow moat
#

what parts are different

#

have you tried making it identical?

stuck geode
#

nope - the only exception appears to be that the class Pteryx (I'm trying to add modifiers to base scores through that) is a scriptable object

#

but I don't think that's the issue

shadow moat
#

I've never seen a tutorial with such sophisticated code

stuck geode
#

it's from 2017

shadow moat
#

thats a bad and good thing.. (the sophisticated code)

stuck geode
#

yeah

#

it could be out-dated

shadow moat
#

I doubt it

stuck geode
#

by now, anyway

shadow moat
#

they dont just update C# and break code

#

unless it was completely deprecated

#

which tutorial are you following specifically

stuck geode
#

I'm up to the third video in the series, which is the last one

#

(I just noticed your profile greeting - right on)

shadow moat
#

my status? lol

stuck geode
#

yeah

stray reef
#

you need to implement the constructor in all subclasses

#

you can do it automatically

shadow moat
#

oHHhh

stray reef
#

select the class name of the subclass , press ctrl + .

#

select "generate constructors"

shadow moat
#

so there were suggestions

stuck geode
#

I'm not sure I understand...

stray reef
#

specify

#

always specify what you dont understand

shadow moat
stuck geode
#

I don't get suggestions for it when hovering over the error

shadow moat
#

not hovering

stray reef
#

click on it, press ctrl + .

#

its same as the lamp icon, or rmb suggestions, but faster

shadow moat
stuck geode
#

got it now

shadow moat
#

when you right click on a class there should be a button that says generate constructor

stuck geode
#

"pick members to be used as constructor parameters" - baseValue isn't there

stray reef
#

show screenshot

stuck geode
stray reef
#

no, cancel

#

the other one

stuck geode
#

okay, so I went ahead & did it with the defaults

stray reef
#

there are 2 options in suggestions, one just straight up generates, other opens that refactoring window

stuck geode
#

you mean in Features?

#

ah; one moment

#

nope - "the other one" being...?

shadow moat
stray reef
#

show screenshot with suggestions

stuck geode
#

suggestions are: generate constructor, generate overrides, extract base class

stray reef
#

no idea why it opens refactoring for you

stuck geode
#

sorry, point; showing screenshot with suggestions is beyond me XD

stray reef
#

ok ctrl + . -> generate constructor

#

what happens?

#

tested on my side, all works

shadow moat
#

this is vs not vsc right

stuck geode
#

vsc?

stray reef
stuck geode
#

lol - gimme your machine

stray reef
#

no its not vcs

#

so?

#

what happens?

stuck geode
#

ctrl+ highlights most of the code

stray reef
#

ctrl + . ?

#

dot

#

its the default hotkey

stuck geode
#

ah; my bad

#

ctrl + . gets the same result

stray reef
#

you really should screenshot the suggestions

#

i suspect you have bigger issue

stuck geode
#

I can't figure out how to keep suggestions active when I use the snipping tool
my bigger issues are that I'm a noob at all this

stray reef
#

forget the snipping tool

#

use sharex

stuck geode
#

one moment

stray reef
#

its pretty big, so study it when you have the time, you can setup automated actions for stuff

#

like "on this key, make a screenshot and upload it to this website, as well as save on disk"

#

also records screen area, sound included!

#

really is the best in its category, no competition

stuck geode
#

oops - I kinda just installed & ran with it
I got a conflict with oneDrive, too

stray reef
#

what conflict? i removed one drive from my system

#

as well as all other ms junk

stuck geode
#

ah, that sounds too much like you know what you're doing: I don't XD

stray reef
#

keep doing stuff, eventually youll know what youre doing

#

dont be scared of any tech stuff, its all made by humans for humans

#

except blender

stuck geode
#

lol - I use blender; or I try to

stray reef
#

i just joke

stuck geode
stray reef
#

thats all?

stuck geode
#

that doesn't help, does it?

#

better, or worse? 😛

stray reef
#

ok save all files, close visual studio

#

go to unity let it recompile

stuck geode
#

done

stray reef
#

even if fails

#

go to your project root folder, delete folder named .vs

#

open visual studio

stuck geode
#

no compilation

stray reef
#

compiler errors?

#

it has to at least try to compile it, even if fails

stuck geode
#

nope - it's hanging on the error with the Ambition class

#

not 'hanging', but hanging onto it

stray reef
#

explain what do you mean

#

editor froze?

stuck geode
#

no

stray reef
#

show unity console

stuck geode
#

it just won't compile while this error is here

stray reef
#

yes but it tried

#

this is fine

stuck geode
stray reef
#

yes

stuck geode
#

that would be in Explorer?

stray reef
#

yes

stuck geode
#

one moment

#

done

stray reef
#

open vs, try generating the ctor

stuck geode
#

same options as before

stray reef
#

and same window?

stuck geode
#

yup

stray reef
#

we can keep on investigating or you can just write the constructor yourself

#

decide

stuck geode
#

write it myself might be easier

stray reef
#

then only thing you should know is that you have to call the base constructor

stuck geode
#

this would be in the Ambition class script?

stray reef
#

in ambition class

#

this isnt a script

stuck geode
#

yeah

#

oh; my bad

stray reef
#

generally unity calls "script" anything that extends MonoBehaviour

stuck geode
#

ah

stray reef
#

tho the whole usage of word "script" is so idiotic i dont know why its still used

stuck geode
#

can you give me the constructor to copy out?

stray reef
#

there is a snippet you can use

#

ctor

#

type it then press tab

#

it will autocomplete

stuck geode
#

so far, so good...

stray reef
#

show me

stuck geode
#

sorry for the image

stray reef
#

yeah it generated the default empty constructor

#

you need it to match the ctor in the base class

#

i.e. parameter must match

stuck geode
#

okay - one moment

stray reef
#

yes now, you have to call the base constructor and pass it the same param

#

you do that by adding : base(param)

#

to the method name

#
public Ambition(float baseValue) : base(baseValue)
{
///```
stuck geode
stray reef
#

done

#

now imagine doing that for 100s of classes

stuck geode
#

lol nothanks

stray reef
#

its why you need eventually to fix the generate ctor thing

stuck geode
#

but that's for another time - thanks for your help
I'll let you get back to more pressing issues

#

you've been super about all this

#

you & Ellie both

stray reef
#

its just a class you cant attach it to a gameobject

stuck geode
#

right - I think I understand

#

I gotta piss - enjoy your day