• 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 /
  • Help Room /
avatar image
0
Question by Cartola · Sep 06, 2015 at 09:05 PM · first person controllerartificial intelligencefield of view

How to detect the field of view in first person?

Guys, i'm making a game in first person and i use the unity 5 and i have a little problem in AI of my enemy in my game... I want to move it only when my character turn her back to him. So, when my character look for him, he will stay stopped. I thought about doing this script and put in the player object or main camera. But, i don't know how do this... someone else know solve this (if possible using javascript) ?

Ps: sorry if my english is bad, i'm still practicing...

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 Cartola · Sep 06, 2015 at 11:19 PM 0
Share

I tried to use it: if(test.GetComponent.().isVisible)

I put the script in prefab of my enemy, which is initially not instantiated in the game.

Then this error appeared:

$$anonymous$$issingComponentException: There is no 'Renderer' attached to the "Enemy(Clone)" game object, but a script is trying to access it. You probably need to add a Renderer to the game object "Enemy(Clone)". Or your script needs to check if the component is attached before using it. CA$$anonymous$$.Update () (at Assets/Scripts/CA$$anonymous$$.js:10)

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

27 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 avatar image avatar image avatar image

Related Questions

On importing unity3d standard assets, first person sample scene is giving error. 0 Answers

The animation state GunShot could not be played because it couldn't be found! Please attach an animation clip with the name 'GunShot' or call this function only for existing animations. 2 Answers

Error with FPSController Standard Assets Script (freshly downloaded / imported) 0 Answers

Basic AI avoidance in 2D 1 Answer

Limitations of multithreading and jobs system 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges