• 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by artachende · Jan 13, 2013 at 03:05 PM · bce0005

Error BCE0005 Unknown identifier

Hi to everyone, I'm studying Unity by using Will Goldstone's Unity Game Development Essentials edited by Packt Publishing Ltd (2009). I'm doing the lesson about the first script making. I've two errors with the script:

 Assets/Scripts/PlayerCollisions.js(29,44): BCE0005: Unknown identifier: 'animName'.

and Assets/Scripts/PlayerCollisions.js(30,44): BCE0005: Unknown identifier: 'animName'.

This is the code I wrote:

 #pragma strict
 private var doorIsOpen : boolean = false;
 private var doorTimes : float = 0.0;
 private var currentDoor : GameObject;
 var doorOpenTime : float = 3.0;
 var doorOpenSound : AudioClip;
 var doorShutSound : AudioClip;
 function Start () {
 
 }
 
 function Update () {
 
     if(doorIsOpen) {
         doorTimes += Time.deltaTime;
         
         if(doorTimes > 3){
             Door(doorShutSound, false, "doorshut", currentDoor);
             doorTimes = 0.0;
         }
     }
     
 }
 
     function OnControllerColliderHit(hit : ControllerColliderHit){
         if(hit.gameObject.tag == "outpostDoor" && doorIsOpen == false){
             currentDoor = hit.gameObject;
             Door(doorOpenSound, true, "dooropen", currentDoor);
             var animName = new animName();
             var thisDoor = new thisDoor();
             thisDoor.animation.Play(animName);
         }
     }
 
 
 
     Door(doorShutSound, false, "doorshut", currentDoor);
 
 
 function Door(aClip : AudioClip, openCheck : boolean, animName : String, thisDoor : GameObject){
     audio.PlayOneShot(aClip);
     doorIsOpen = openCheck;
     
     thisDoor.transform.parent.animation.Play(animName);
 }
 
 
 @script RequireComponent(AudioSource)


I don't understand where is the error

I've Unity 3.5.6f4 installed and I use the free version of the software.

Can you help me? Thanks

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 Lovrenc · Jan 13, 2013 at 03:08 PM 0
Share

var animName = new animName();

this is wrong (except if you actully wrote animName class). You should just enter the string name of your animation (eg. "doorOpening"). That is what Play function accepts.

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

9 People are following this question.

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

Related Questions

BCE 0005 unknown identifier error when accessing global variable. 5 Answers

FPS tutorial projectile scripting error 1 Answer

BCE0005: Unknown identifier 1 Answer

Add seconds to timer countdown. 3 Answers

How to use EditorUtility.InstantiatePrefab? 5 Answers

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