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 Revenantue · Sep 12, 2010 at 07:07 PM · collisionsignorebce0020

How to use CollisionIgnoreManager.cs

Hi, I'm having problems using the CollisionIgnoreManager script. I want to start adding objects to the arrays but it's not working.

The code I'm using is this:

In CollisionIgnoreManager.cs I'm assuming the function I need is this one:

 public void addIgnore( Collider newCollider ) {
    addIgnore( newCollider, 0xffff, 0xffff );
}

And I'm trying to acces it from within a js with this:

CollisionIgnoreManager.addIgnore(collider);

However I get this message:

"BCE0020: An instance of type 'CollisionIgnoreManager' is required to access non static member 'addIgnore'."

I know that Javascripts are called before C# so I already moved the CollisionIgnoreManager.cs script to my Standard Assets folder.

Any ideas?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Ryan Scott · Oct 19, 2010 at 01:32 AM

Sorry I've been lax about checking answers. I am the author of CollisiognIgnoreManager.

You need to add this script to some component in your scene (it doesn't matter which or where that game object is, it just needs to be added). This class is setup to operate as a Singleton, such that the class itself stores a reference to the instance. As such you should only add a single CollisionIgnoreManager script to your scene (i.e. don't put it on multiple objects or anything like that).

Once it is in your scene access it like so: CollisionIgnoreManager.getInstance().AddIgnore( whatever );

I haven't revisited that code in some time, and certainly it can be cleaned up, but that is how you would use the version that is on the wiki currently.

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

Answer by Peter G · Sep 12, 2010 at 07:29 PM

Your error means that you have to get a reference to an instance of CollisionIgnoreManager. I don't know how that script works though, so it either wants the script attached to an object.

//Probably this one.
//______________________________________________
var collisionController : CollisionIgnoreManager = SomeGameObject.GetComponent(CollisionIgnoreManager);
collisionController.AddIgnore(collider);
//______________________________________________

or, if that is not how the script is setup then you just have to make a new instance in your script.

collisionController = new CollisionIgnoreManager();
collisionController.AddIgnore(collider);

My best advice would be to wait until Unity 3 comes out with layer based collisions unless you need your game to be released in the next month or so (there is no public date for the release. Just summer 2010.)

Comment
Add comment · Show 1 · 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 Revenantue · Sep 12, 2010 at 07:40 PM 0
Share

The first approach is not returning any errors... but the script is not working. Evidently I'm doing something (very) wrong.

The script I'm trying to use is this (in case anyone wants to take a look):

http://www.unifycommunity.com/wiki/index.php?title=CollisionIgnore$$anonymous$$anager

It's supposed to avoid collisions in groups rather that in single objects. I'll make some more tests.

Thanx Peter G :)

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

Can Physics.IgnoreCollision disable OnTrigger... events? 2 Answers

Collision Matrix not working as intended 1 Answer

How to detect collisions with materials? 0 Answers

How do you free a child opbject from it's parent upon collision ? 1 Answer

Dynamic collisions 0 Answers


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