Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
Zacstar11

Weapon Attachment System: Weapon Manager

Question

Hi guys

 

So I recently been tweaking this script  Please login or register to see this link.  to work with the weapon manager of the fps kit.I figured if I got the script to set the variable of weaponsInUse of the weapon manager to the selected gameobject it would work with the weapon manager So to do that I replaced this: 

Please login or register to see this code.

With this:

Please login or register to see this code.

however I'm getting the following error code:

Assets/Scripts/Decodificator.js(54,63): BCE0022: Cannot convert 'UnityEngine.GameObject' to 'UnityEngine.GameObject[]'.
 

I know it's to do with the array of the weaponsInUse variable but I can't seem to fix it.

 

Any help would appreciated

Edited by Zacstar11

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts


  • 0

Why are you getting a component from a script? Its supposed to be a object.

Share this post


Link to post
Share on other sites
  • 0

@YoungDeveloper. I did think of that but everything I've tried just hasn't worked.

@DaBossTMR. I'm not using the script Weapon Manager but the gameobject thats child of the player called Weapon Manager

Edited by Zacstar11

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

You didn't answer to question, is variable "weaponsInUse" an array or not.

Share this post


Link to post
Share on other sites
  • 0

You can't assign anything to array itself, only to array index element. Here's the idea

Please login or register to see this code.

Share this post


Link to post
Share on other sites
  • 0

Thanks YoungDeveloper it's working now, I'm so stupid, now that I've got this working I might improve some things & release it as an example project to the community.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...