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 LordZephyr · Feb 12, 2013 at 12:37 AM · erroriosguitexturefirstpersoncontroller

Why am I getting this error message on my iOS game when I change scenes?

Hi, I can't seem to figure out this error message. I would appreciate any help.

I am creating an iOS game and when the player walks into a trigger, it will transfer him to another level (scene). Each time I remotely play each level seporately, everything is fine but when I play from one level and trigger the change level trigger, I get this error message:

MissingReferenceException: The object of type 'GUITexture' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. UnityEngine.GUITexture.set_pixelInset (Rect value) Joystick.ResetJoystick () (at Assets/Standard Assets (Mobile)/Scripts/Joystick.js:97) Joystick.LatchedFinger (Int32 fingerId) (at Assets/Standard Assets (Mobile)/Scripts/Joystick.js:115) Joystick.Update () (at Assets/Standard Assets (Mobile)/Scripts/Joystick.js:183)

I am using the iOS first person controller for all my levels. In fact, I even made a prefab of the first person controller because I added a triggering sphere on it so that the players can change levels. Even when I used the "stock" first person controller, I still received the error. I did not change anything on any of the scripts of the mobile first person controller. The game works fine when I build it and install it on my iPhone. I just don't like having error messages.

Thanks for any help you may give.

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

Answer by PAEvenson · Feb 12, 2013 at 03:18 AM

I want to say the object is being accessed while the scene is trying to clean up and release everything. You can try waiting until the end of frame before you load the level.

 public void ChangeLevel()
 {
      StartCorountine(WaitUntilEndOfFrameToLoadCoroutine("Next Level"));
 }
 
 public IEnumerator WaitUntilEndOfFrameToLoadCoroutine(string nextLevel)
 {
        yield return new WaitForEndOfFrame();
        Application.LoadLevel(nextLevel);
 }

Its a hack, but hey, it works.(Hopefully :P)

Comment
Add comment · Show 11 · 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 Bovine · Feb 12, 2013 at 06:33 AM 0
Share

Highly unlikely to work - I'm not even sure its possible and I would not recommend the solution: it is both a hack and likely to have no effect.

I imagine his first person controller is resetting the position of the joystick thumb controls but that the thumb controls were deleted in the previous scene.

avatar image PAEvenson · Feb 12, 2013 at 11:31 AM 0
Share

Well if you are calling DontDestroyOnLoad anywhere....look there first.

avatar image Bovine · Feb 12, 2013 at 11:49 AM 1
Share

Or he needs to call DontDestroyOnLoad on the thumb graphics

avatar image PAEvenson · Feb 12, 2013 at 01:34 PM 0
Share

It really depends on how your scenes are set up. I dislike using DontDestroyOnLoad because you need to manually destroy the objects later. Failing to destroy them could lead to duplicates when you load their initial scene again. There are multiple ways around this, but the only time I flag an object as DontDestroyOnLoad is when I manually instantiate an object in a script. This way I can check to see if one already exists before instantiating a new one.

avatar image Bovine · Feb 12, 2013 at 03:06 PM 0
Share

I only ever use it for objects that persist for the lifetime of the game - any other use feels a bit fragile.

Show more comments
avatar image
0

Answer by CoixdeNono · Feb 13, 2013 at 04:11 PM

I think if you try to create a gameobject kept on load, that is not destroyed between the scenes, and where you can put the function that is called between the scenes. Like here "The object of type 'GUITexture' has been destroyed but you are still trying to access it. "

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 Bovine · Feb 13, 2013 at 04:55 PM 0
Share

Yes, I think everyone else has been saying this or a variation of it in the thread of comments below. Ideally $$anonymous$$ needs to upload his scenes somewhere so someone can point at the issue.

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

12 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

Related Questions

ERROR: Google play services on IOS 2 Answers

Splash Screen IOS CRASH. 0 Answers

XCode 4.6.3 iOs Build launch screen checkBytes issue 0 Answers

Calling Function in other Script via Touch => iOS Crash 1 Answer

GUITexture in Unity 5 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