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
0
Question by NinjaDesigns · Feb 20, 2014 at 05:54 AM · colliderwaypointwaypoints

Waypoint Coliider Error

Error message: gameObject is not a member of 'UnityEngine.Collider[]

Im going through a tutorial teaching me how to do waypoint AI pathing.

Heres all my code, Ive heard there can be issues will calling a GameObject, did I miss type something?

 var neighbors:Collider[];
 
 function Update () {
 
 }
 //the function to receive data
 var countdown: int = 3;
 
 function setData(incomingData)
 {
     countdown = incomingData;
     countdown --;
     Debug.Log("the waypoint " + this.name + " sent the countdown of " + countdown);
     sendData();
 }
 function sendData ()
 {
     if (countdown > 0)
     {
         for (var neighbor in neighbors)
         {
             neighbors.gameObject.GetComponent(Waypoint).setData(countdown);
         }
     }
 }
 //the function that sends data to the neighbors
 
 var mask : LayerMask = 1 << 8;
 
 var sphereDistance: int = 10;
 private var breakWhile: int = 1;
 
 function Awake () {
     while (neighbors.Length < 3 && breakWhile < 10){
         neighbors = Physics.OverlapSphere(transform.position,sphereDistance,mask);
         sphereDistance += 10;
         breakWhile ++;
     }
 }
Comment
Add comment · Show 1
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 MattMorris · Feb 20, 2014 at 05:59 AM 0
Share

What compiler errors are you getting, cause what stands out to me is your not type casting (IE i want this variable to of this type... further IE, var myInt : int = 1, where int is the type and var is the reciever of that type or the one its being cast to) the setDate variable so the inco$$anonymous$$gData. That seems to be the biggest thing standing out to me, but in future posts if you could also include the error your getting it would be a big help!

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by robertbu · Feb 20, 2014 at 05:56 AM

You don't list the line number of the error, but it has to be line 22. You should be using 'neighbor' not 'neighbors' in this line.

   neighbor.gameObject.GetComponent(Waypoint).setData(countdown);

That is the for() loop is pulling out each entry in the array one at a time and assigning that one for the current iteration to 'neighbor'. That single collider is what you should be referencing.

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

20 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

Related Questions

How to play an animation with waypoints 1 Answer

Why isn't a Ai Waypoint Spawning??? 0 Answers

Make player follow waypoints, but still control it's X axis 3 Answers

FPS Tutorial Waypoints question 2 Answers

Why doesn't my camera stay on the moving Waypointprogresstracker circuit? 0 Answers


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