C
C#2y ago
alaa2008

error: feature `declaration expression' cannot be used because it is not part of the c# 6.0 language

in unity i am getting this error here: feature declaration expression cannot be used because it is not part of the c# 6.0 language specification i don't know how to fix that. can someone please help me? thanks. here the full code: https://pastebin.com/KQt7rG72 line 439.
Pastebin
using System;using System.Collections.Generic;using SBS.Math;using ...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
42 Replies
Thinker
Thinker2y ago
Is this the result of a decompiler? What are all these //IL_0034: Unknown result type (might be due to invalid IL or missing references)
ero
ero2y ago
it is the casts give it away if the comments didn't already
Thinker
Thinker2y ago
In which case the error appears to be that you're using a decompiler (for some reason) which has decompiled the code to a version greater than that which the Unity version that you're using supports.
Jimmacle
Jimmacle2y ago
Yeah definitely decompiled unity code Which brings up the question of tos breakage
Thinker
Thinker2y ago
Although if you're wondering what the error actually means, you can't do out var hitInfo in C# 6, you have to declare hitInfo before the method call and do just out hitInfo.
alaa2008
alaa2008OP2y ago
I'm sorry man Thx bro so how should i declare it? like int hitinfo; ?
Jimmacle
Jimmacle2y ago
what type is hitinfo supposed to be?
alaa2008
alaa2008OP2y ago
uh just updated the script a bit because i destroyed it a bit.
alaa2008
alaa2008OP2y ago
Pastebin
// Warning: Some assembly references could not be resolved automati...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
alaa2008
alaa2008OP2y ago
anyways back to the error
Thinker
Thinker2y ago
Just gonna ask again, why are you decompiling this and from where is this?
alaa2008
alaa2008OP2y ago
it was an unity game back from 2013 i think and it stopped working on browser like i mean i can run it but there are no play buttons and we can't figure it out why it has to do something with the unity player so some people asked me if i can just do a standalone version of the game so i agreed idk man the game is called Lose the Heat 3 i have all the files the only thing i need to do is fix the scripts thats all but if you can't help me out then its fine
Thinker
Thinker2y ago
It's still the same error as before?
alaa2008
alaa2008OP2y ago
yea
Thinker
Thinker2y ago
What type is hitInfo? You just have to declare it before using it in the GetToken call and change out var hitInfo to just out hitInfo
alaa2008
alaa2008OP2y ago
can you tell me how to declare it? since my english is not that good. xD
Thinker
Thinker2y ago
like you wrote here
alaa2008
alaa2008OP2y ago
oh ok wait
alaa2008
alaa2008OP2y ago
Thinker
Thinker2y ago
huh
alaa2008
alaa2008OP2y ago
like this?
Thinker
Thinker2y ago
what does the error say?
alaa2008
alaa2008OP2y ago
Thinker
Thinker2y ago
that's... odd oh you just spelled it wrong
alaa2008
alaa2008OP2y ago
oh
alaa2008
alaa2008OP2y ago
Thinker
Thinker2y ago
what does it say now?
alaa2008
alaa2008OP2y ago
Thinker
Thinker2y ago
well you declared it with the wrong type then
alaa2008
alaa2008OP2y ago
what type should i declare?
Thinker
Thinker2y ago
says in the error TokensManager.TokenHit
alaa2008
alaa2008OP2y ago
oh ok wait so it means: int TokensManager.TokenHit;
Jimmacle
Jimmacle2y ago
PepeHmmm
alaa2008
alaa2008OP2y ago
or this one?
alaa2008
alaa2008OP2y ago
Thinker
Thinker2y ago
again, what is the error
alaa2008
alaa2008OP2y ago
Thinker
Thinker2y ago
no idea what that is supposed to mean Why does it say Assembly-CSharp and why are the method names different
alaa2008
alaa2008OP2y ago
idk man this shit way too complicated however in unity the error is gone i don't give a shit then if the error is gone then good anways thx guys really you really have a heart of gold i gtg now cya
Thinker
Thinker2y ago
$close
MODiX
MODiX2y ago
Use the /close command to mark a forum thread as answered
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server