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 Nab · Jan 17, 2011 at 03:38 PM · prefabfollowsteeringunitysteer

Unity Steer - Setting Quarry in Steer for Pursuit problem

Hi,

At present I have instantiated enemies with very basic AI. They spawn, they run at the player. End of story.

I want to overhaul my enemies using Unity Steer so that they avoid buildings/obstacles and each other, but I've run into a problem.

As my enemies are instantiated from prefabs rather than already in the scene, I seem to be unable to set my 3rd Person Controller (The Player) as the Quarry when using Steer for Pursuit. If I place an enemy on the level I can do it, but not if it's a prefab.

I've tried also making my 3rd person controller a prefab and setting it to that but that didn't work either.

Any help would be much appreciated.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Jesse Anders · Jan 17, 2011 at 06:52 PM

I'm going to guess that you're trying to assign a reference to an object in the scene to a field of a script associated with a prefab.

If so, this won't work. Think about it this way. Prefabs exist outside of any particular scene. If a reference associated with a prefab points to an object in a particular scene, where will that reference point when a different scene is loaded? The object it points to won't even exist at that point.

What you'll most likely need to do is assign the player reference when the AI agent is instantiated. There are several ways this can be done; one would be to assign the reference immediately after instantiation using the return value of Instantiate(), and another would be to search for the player by name or tag and grab a reference in the Awake() or Start() function of a script associated with the AI agent.

Comment
Add comment · Show 4 · 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
avatar image Nab · Jan 18, 2011 at 10:16 AM 0
Share

Thanks, I think I understand what you mean about the prefabs existing outside the scene.

I'll have a go at what you suggest and report back!

avatar image Nab · Jan 18, 2011 at 10:35 AM 0
Share

Hmmm.

Well, I've come into a problem with it. I've decided to try and search for the player by tag, but I'm getting the error "Cannot implicitly convert type 'UnityEngine.Transform' to 'Vehicle' or vice versa depending on which way I try to do it in the SteerForPursuit script.

Are you familiar enough with Unity Steer to offer any insight into a way around that? I could post the whole script if it's useful?

avatar image Nab · Jan 18, 2011 at 11:35 AM 0
Share

Never$$anonymous$$d, solved this with some other help! Thanks for your input!

avatar image Ranth · May 26, 2015 at 11:32 PM 0
Share

Can you let me know what you did? I am running into this issue with trying to send GameObjects to SteerForPursuit when they expect DetectableObjects.

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

No one has followed this question yet.

Related Questions

Unitysteer - Rigidbody with gravity stops steering 2 Answers

UnitySteer SteerForPursuit: How do you Change quarry After the current quarry gets destroyed 0 Answers

Help with kinematic NPCs following non-Kinematic player and avoiding obstacles 0 Answers

Camera rotation around player while following. 6 Answers

Objects not following 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