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 Wuzseen · Jul 02, 2012 at 10:54 PM · scenenullexceptionunassigned

Exceptions When Changing Scenes

Hi all,

I've got a simple main menu in my game and when I start my game from this menu, I get NullReference and UnassignedReference exceptions for the first person controller motor and a prefab I've made respectively. Specifically, the Transform variable I have in a script (generateSpheres) that refers to a prefab (multiplierPickup) I've made, has not been assigned according to the error.

When I simply play the scene I'm transitioning into I have no issues whatsoever. Indeed, all of these things are assigned in the correct scene.

Here's the code that loads my level. My problem is though, I'm not really sure what is relevant to the problem.

 function OnMouseUp()
 {
  if( !isQuit )
  Application.LoadLevel("main");
  else
  Application.Quit();
 }

As I said, I'm not entirely sure what's going on here. I don't know what code is relevant, etc. Hopefully you guys can understand the issue though.

The debugger suggest that I need to define the variable in the inspector view for the script. This has been done, I just don't know what's still causing issues. It was working at first, but I added in a second type of prefab/pickup. While there are no issues with the scene I am loading when I just load that scene, when I load it from my mainMenu scene, I have these errors.

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 nastasache · Jul 03, 2012 at 08:20 AM 0
Share

$$anonymous$$ore relevant it's code where the variable generateSpheres it's used. If the debugger say the variable it's not assigned mean exactly that; in a way or other the generateSpheres it's loosing the reference to the multiplierPickup during of gameplay.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Wuzseen · Jul 03, 2012 at 03:46 PM

I legitimately have no clue as to how I fixed the problem. It just fixed itself and that's all I really know.

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 roamcel · Jul 03, 2012 at 08:29 AM

This might be a tricky problem: if you assign a new gameobject to a TRANSFORM, there'll be no compiling errors... but you'll get runtime errors!

Make sure that you assign the instance to a GAMEOBJECT rather than a transform. This should fix your problem.

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

6 People are following this question.

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

Related Questions

why a list of transforms is empty after loading new scene? 2 Answers

NullReferenceException - With Network PlayerSpawn 0 Answers

Strange Xcode Error for iOS? YS Bundle Null Exception 0 Answers

Unassigned Reference Exception error? 4 Answers

Null reference Exception - but it's all there 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