Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
3
Question by ScottUnityNoob · Apr 04, 2017 at 05:35 AM · instantiateprefabtriggercharacter controllercapsulecollider

is the Character Controller a Collider?

Hello, I'm having a simple issue but I'm not sure how to resolve it.

I have an "EnemySpawnTrigger", when the player enters the trigger, an enemy prefab is instantiated.

public class EnemySpawnScript : MonoBehaviour {

 public GameObject EnemyPrefab;
 public Transform EnemySpawnZone;



 void OnTriggerEnter(Collider other)
 {
     if(other.gameObject.CompareTag("Player")) 
         {
         Instantiate(EnemyPrefab, EnemySpawnZone.position, EnemySpawnZone.rotation);
         }
     Destroy(this.gameObject, 0.5f);
 }

} The problem is, my "FPSController" has a "Capsule Collider (isTrigger)" attached to it, it has a smaller radius than the "outline of the Character Controller".

Basically, when I enter the trigger, the "outline of the Character Controller" instantiates one prefab. Then, a split second later, the inner "Capsule Collider" instantiates a second prefab. (Unwanted)

The reason I'm using the "Capsule Collider" is for Parenting the Player with an elevator/ platform system. So, I would like to keep it there if possible.

Any solutions? Any help would be greatly appreciated, Thanks!

Comment
Add comment · Show 2
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 Commoble · Apr 04, 2017 at 05:42 AM 0
Share

I would suggest finding a way to get your elevators to work without the second capsule collider. Are you sure you can't accomplish whatever you're using it for with just the primary collider?

avatar image ScottUnityNoob Commoble · Apr 04, 2017 at 05:49 AM 0
Share

Hi, thanks man! So the "Character Controller" is the primary collider? I was told before that it is not a collider and I need to attach an additional collider. Prob shouldn't have listened to that guy haha. I'll try what you said, Thanks!

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Namey5 · Apr 04, 2017 at 06:09 AM

As far as I can tell, the Character Controller is not part of the Collider class, however it is an extension of it; as such collider elements will still work regardless.

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 ScottUnityNoob · Apr 04, 2017 at 04:52 PM 1
Share

Thanks for your reply! I made some simple changes to my script & it's working fine now without the additional collider. Cheers!

avatar image
0

Answer by konsic · Aug 29, 2018 at 10:50 AM

How did you change the script ?

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

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

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

Related Questions

My code is instantiating many prefabs, i only want one. 1 Answer

instantiated prefab doesn't follow spawn rotation 1 Answer

Call function for instantated prefab. "Object reference not set" 1 Answer

Simple Prefab Instantiate "(Clone)" Question 3 Answers

Instantiate and destroy an object with the same key 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