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 chrismisballs · May 10, 2011 at 07:10 PM · errorbootcampbce0004

BCE0004: Ambiguous reference 'gameObject': TrainingDummyPart.gameObject, UnityEngine.Component.gameObject.

The title says it all. What does it mean?

I get the error when ever dp is called but i have it listed as a variable..any clues?

function Destruct(target : int) { var dp : TrainingDummyPart = dummyParts[target];

     if(dp.gameObject == null) return;

     dp.shootsTaken = shootsToDestroyPart;

     var go : GameObject;

     if(dp.gameObject.transform.parent != null)
     {
         if(dp.gameObject.name.Contains("head") || dp.gameObject.name.Contains("neck"))
         {
             if(!dead)
             {
                 dead = true;
                 TrainingStatistics.dummies++;
                 GunEffects(false);

                 //audio.PlayOneShot(dieSound);

                 Destruct(4);

                 //animation.CrossFade("dum_death");
             }
         }

         if(dp.gameObject != weapon)
         {
             dp.gameObject.transform.parent = null;
             dp.gameObject.active = false;

             for(var i : int = 0; i < dp.brokeParts.length; i++)
             {
                 go = dp.brokeParts[i];

                 if(go.transform.parent == null) continue;

                 InitializeMeshCollider(go);

                 DestroyPart(go, false);
             }

             for(var j : int = 0; j < dp.siblings.length; j++)
             {
                 go = dp.siblings[j];

                 if(go == null) continue;
                 if(go.transform.parent == null) continue;

                 if(go.name.Contains("head"))
                 {
                     dead = true;
                     TrainingStatistics.dummies++;
                     //audio.PlayOneShot(dieSound);
                     GunEffects(false);
                 }
                 if(go == weapon) 
                 {
                     canShoot = false;
                     GunEffects(false);
                 }

                 DestroyPart(go, false);
             }

             Destroy(dp.gameObject);
         }
         else
         {
             canShoot = false;
             GunEffects(false);

             if(weapon.transform.parent != null)
             {
                 DestroyPart(weapon, false);
             }
         }
     }
     else
     {
         if(dp.gameObject != weapon)
         {
             dp.gameObject.active = false;

             for(i = 0; i < dp.brokeParts.length; i++)
             {
                 go = dp.brokeParts[i];

                 InitializeMeshCollider(go);

                 DestroyPart(go, false);
             }

             Destroy(dp.gameObject);
         }
     }
 }

 function Hit(hit : RaycastHit, target : int, damage : int)
 {
     if(!running) 
     {
         running = true;
     }

     var dp : TrainingDummyPart = dummyParts[target];

     if(dp.gameObject == null) return;

     dp.shootsTaken += damage;

     var go : GameObject;

     if(dp.gameObject.transform.parent != null)
     {
         if(!dead) 
         {
             if(dp.dummyPart == DummyPart.CHEST)
             {
                 var dir : Vector3 = hit.point - transform.position;

                 if(Vector3.Dot(dir, transform.right) > 0)
                 {
                     TrainingStatistics.Register(dp.dummyPart);
                 }
                 else
                 {
                     TrainingStatistics.Register(DummyPart.HEART);
                 }
             }
             else
             {
                 TrainingStatistics.Register(dp.dummyPart);
             }
         }

         if(dp.shootsTaken == shootsToDestroyPart - 1)
         {
             if(dp.gameObject != weapon)
             {
                 enableFailEffect = true;
             }
         }
         else if(dp.shootsTaken >= shootsToDestroyPart)
         {
             if(dp.gameObject.name.Contains("head") || dp.gameObject.name.Contains("neck"))
             {
                 if(!dead)
                 {
                     dead = true;
                     TrainingStatistics.headShoot++;
                     TrainingStatistics.dummies++;

                     //audio.PlayOneShot(dieSound);
                     GunEffects(false);

                     if(state != 0)
                     {
                         Hit(hit, 4, shootsToDestroyPart);
                     }

                     //animation.CrossFade("dum_death");
                 }
             }

             if(dp.gameObject != weapon)
             {
                 dp.gameObject.transform.parent = null;
                 dp.gameObject.active = false;

                 for(var i : int = 0; i < dp.brokeParts.length; i++)
                 {
                     go = dp.brokeParts[i];

                     if(go.transform.parent == null) continue;

                     InitializeMeshCollider(go);

                     DestroyPart(go, true);
                 }

                 for(var j : int = 0; j < dp.siblings.length; j++)
                 {
                     go = dp.siblings[j];

                     if(go == null) continue;
                     if(go.transform.parent == null) continue;

                     if(go.name.Contains("head"))
                     {
                         dead = true;
                         TrainingStatistics.dummies++;
                         //audio.PlayOneShot(dieSound);
                         GunEffects(false);
                     }
                     if(go == weapon) 
                     {
                         canShoot = false;
                         GunEffects(false);
                     }

                     DestroyPart(go, true);
                 }

                 GameObject.Instantiate(explosionEffectPrefab, hit.point, Quaternion.identity);

                 Destroy(dp.gameObject);
             }
             else
             {
                 canShoot = false;
                 GunEffects(false);

                 if(weapon.transform.parent != null)
                 {
                     DestroyPart(weapon, true);
                 }
             }
         }
     }
     else
     {
         if(dp.gameObject != weapon)
         {
             dp.gameObject.active = false;

             for(i = 0; i < dp.brokeParts.length; i++)
             {
                 go = dp.brokeParts[i];

                 InitializeMeshCollider(go);

                 DestroyPart(go, true);
             }

             Destroy(dp.gameObject);

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
1
Best Answer

Answer by DaveA · May 10, 2011 at 07:28 PM

What does your TrainingDummyPart script look like? Because the error is saying that it defines a .gameObject member, and so does UnityEngine.Component, and it doesn't know which one you mean to use. You shouldn't need to define a .gameObject member, but if you do, call it something else, would be the easiest thing. Or you can specify UnityEngine.Component.gameObject each time which gets messy.

Comment
Add comment · Show 2 · 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 chrismisballs · May 10, 2011 at 09:08 PM 0
Share

it looks like this

class TrainingDummyPart extends $$anonymous$$onoBehaviour { @HideInInspector public var name : String;

 public var gameObject : GameObject;
 //public var boxCollider : BoxCollider;
 public var siblings : GameObject[];
 //public var siblingParts : TrainingDummyPartHelper[];
 public var brokeParts : GameObject[];
 public var shootsTaken : int;
 public var dummyPart : DummyPart;
 
 function Start()
 {
     shootsTaken = 0;
 }

}

avatar image chrismisballs · May 10, 2011 at 09:22 PM 0
Share

I got ride of the public var GameObject : GameObject and now no more errors thankyou.

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

What does BCE0004: Ambiguous reference error mean? 3 Answers

Downloading Bootcamp from Asset Store An Error Appears 0 Answers

Unity 5 Error: The imported type is defined multiple times 3 Answers

'TerrainData' does not denote a valid type 1 Answer

Failed to call function Hit of class TrainingDummy 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