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 Xyrious Industries · May 18, 2015 at 10:18 AM · playersceneontriggerenterchangefirst person controller

Unity 5 OnTriggerEnter Change scene, Not working

Essentially im attempting to create a gameobject, make it a trigger, and have the first person controller, the new one from unity 5 by the way, go into and change from the current scene to a different one.

When i try to add this script to my empty gameobject, it tells me it is an editors script and cannot be added to the empty game object, i want to know how to either fix this, or get around this.

personally, this is especially frustrating because its only since unity 5 has this been a problem for me, in fact, with scripting having a complete overhaul, the code is unnecessarily longer.

Comment
Add comment · Show 4
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 Tonks · May 18, 2015 at 05:14 PM 0
Share

Can we see the Change Scene script? I assume you have some sort of...

 protected void OnTriggerEnter() {
 if collision....
 }

setup going on?

avatar image Fappp · May 18, 2015 at 06:33 PM 0
Share

Or JS?

 function OnTriggerEnter( col : collider ){
 if ( col.CompareTag("SceneSwitcher"){
 //loadlvl
 }
 }
avatar image tanoshimi · May 18, 2015 at 06:40 PM 0
Share

A gameobject cannot be a trigger. A gameobject can have a collider component attached to it that is set to be a trigger, which I suspect is what you meant, but it won't do anything unless you also attach a script component that implements one of the OnTriggerXXX functions.

If you have a problem with such a script, you need to post that script with your question, along with the full, accurate error message it generates.

There have been some changes to the scripting API between 4.x -> 5.x, but certainly not a complete overhaul. The biggest single change is the removal of .transform, .collider etc. shortcuts to GetComponent. That's it.

avatar image Xyrious Industries · May 18, 2015 at 07:08 PM 0
Share

I have a gameobject that has a box collider, set to "Is Trigger" I have a loadlevel attachment to the ontriggerenter. when i attempt to apply the loadlevel script, it says it is an editors script, and cannot be added.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by anthodb · Jun 18, 2015 at 04:13 PM

I had same issue and I had to set both of my colliding Gameobjects on the "CollisionLayer". Then it worked ;) I don't know if this is a new feature of Unity5 but I can tell I spent most of the day searching for a solution.. Hope that helps..

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Player object carried from scene to scene 1 Answer

Change scenes from area? 1 Answer

carrying player data from one scene to the next 1 Answer

Load scene when colliding on GameObject 1 Answer

When Near Object, Change Scene 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