Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-2
Question by Seventh Stealth · Feb 09, 2015 at 06:21 PM · javascriptai

ERROR : QUACK is not a generic definition. What now?

     var enemyUnit : GameObject[];
      var enemyAIScript : EnemyAI[];
      var enemyHuntScript : EnemyHunt[];
      function Start(){
    //Line18  enemyUnit = GameObject.FindGameObjectsWithTag("Enemy");
    //Line19  enemyAIScript = enemyUnit.GetComponent.<EnemyAI>();
      enemyHuntScript = enemyUnit.GetComponent.<EnemyHunt>();
      alert = false;
      caution = false;
      normal = true;
      }
 

Help. I was just doing my thing editing a script when I got the error in the console

Enemies/RegularUnits/ControlAI.js(19,43): BCE0138: 'quack' is not a generic definition.

What do I do ? I dont even have anything called quack in my script

Comment
Add comment · Show 10
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image smoggach · Feb 09, 2015 at 06:24 PM 0
Share

save your file and recompile?

avatar image Hoeloe · Feb 09, 2015 at 06:27 PM 0
Share

It's probably because you've set up all your variables as arrays, and are trying to use generics to assign single instances to them.

avatar image Seventh Stealth · Feb 09, 2015 at 06:30 PM 0
Share

how do i recompile

avatar image Owen-Reynolds · Feb 09, 2015 at 09:47 PM 0
Share

I think this script is totaled. Start with something simpler in a fresh project, see all the easy errors and how to fix, and work your way up. The first few things you make are always going to be just for learning.

Quack? What are you following that would even have a quack in it? So you can tell other people to avoid it.

avatar image Hoeloe · Feb 09, 2015 at 09:57 PM 1
Share

The "quack" is due to the nature of the error. Javascript, by default, uses Duck Typing, which is often summarised as "if it quacks like a duck, it's a duck". By using generics, you're enforcing hard types, rather than allowing duck typing to work properly. Since those types don't match, the duck typing in the compiler can't unify the two types (it can't deter$$anonymous$$e how to make the object "quack"), so it throws an error.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by DRProductions · Feb 10, 2015 at 02:40 AM

You've declared all your variables as if they were arrays and then you tried to acess them like they weren't. Remove the [] after your variable types. eg, its not enemyunit : GameObject[] its enemyunit : GameObject OR acess your arrays properly. instead of saying enemyunit.Getcomponent say enemyunit[Insert index number here].getcomponent

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Help with Enemy AI 1 Answer

AI Path and respawn help!!! 0 Answers

2D sidescroller ranged character shooting problem. 0 Answers

Stealth AI Script. If less than or equal to not working correctly. Any fixes ? 1 Answer

Ai continues to move after calling it to stop 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges