Error CS0019 Operator `+´ cannot be applied to operands of type `float´ and `WeaponObject´ Has anyone an idea? I'm new at unity and haven't any ideas!
Hey guys,
sorry, but can somebody help me?
Thank you!!!
welcome. you're more likely to get help if you post the actual code, not a screenshot. check the user guide for how to...
The code is located in the attached picture. @palahd, please format the code in the OP next time.
It seems like your currentWeapon variable equals an object in the start method which might do it depending on what Weapons[] is (According to the error it seems to name 'WeaponObject'). If you want a float to equal the index number of Weapons[] have a new float equal o which I believe is an int since it is used to index Weapons[]. But seriously, how can anybody tell what's wrong with this code until you show more of it.
@palahd doesn't it look weird to you that you are trying to add 'time' + 'weapon' together?
What should the result be when you add 2 seconds + assaulRifle
? Are you perhaps trying to add something like currentWeapon.reloadTime
?
Your answer
![](https://koobas.hobune.stream/wayback/20220612052604im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do you copy an image from the clipboard into an ui image? 0 Answers
Problem with Score/Highscore script 0 Answers
[Admob] Interstitial script The type `InterstitialAd' does not contain a constructor 1 Answer
Viewing other processes while debugging in unity 0 Answers
Weapon Fire Rate does not change intervals between each bullet C# 0 Answers