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
1
Question by brag42 · Oct 18, 2012 at 05:35 PM · directiondrawisvisible

How can I draw indicators from my ship to off-screen enemies?

I want to have some indicator near the player's ship that points to enemies that are off the screen. How do I find the position of all enemy objects in the scene and then draw an indicator (at some small radius from the ship) in each of those directions? I do know how to use renderer.isVisible.

Thanks in advance. :)

Comment
Add comment · Show 8
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 Fattie · Oct 18, 2012 at 05:37 PM 0
Share

get Vectrosity,

or grab this amazing little package

http://gameassets.net/demo/dynamiccircles.html

from the asset store,

or use Unity's "LineRenderer" (search on here for 100s questions about LineRenderer)

to find the position of enemy objects use ".position"

avatar image whydoidoit · Oct 18, 2012 at 05:50 PM 0
Share

To get a list of them use FindWithTag

avatar image brag42 · Oct 19, 2012 at 01:40 AM 0
Share

Thanks, Fattie and whydoidoit. LineRenderer will do the trick and those assets looks great.

FindWithTag returns one object, if I read the description correctly. Is there a systematic way of cycling through all enemies each frame? Do I need to come up with a tricky way of alternating their tag each frame to make sure I get to all of them? If it returned a list of all objects with a tag, that would be useful.

avatar image always_beta · Oct 19, 2012 at 03:57 AM 0
Share

You can use FindGameObjectsWithTag to get all game objects with the tag. And cycling through all enemies each frame is not good. Hold a list of references to those enemies and modify the references when a new enemy born or die might be better(or any other solutions, but try to avoid doing duplicated things for every frame)

avatar image brag42 · Oct 23, 2012 at 01:49 PM 0
Share

You've all been very helpful. Thank you!

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

12 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

Related Questions

Local Direction of Vector3 1 Answer

How to calculate direction between 2 objects 2 Answers

2d fire from player towards mouse 1 Answer

Quaternion multiplication 1 Answer

Adding force to an object based on its current angle. (2D) 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