• 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
1
Question by Zybrion · Dec 07, 2014 at 10:10 PM · cameraerrorscenescene-loading

The 3D camera no longer exists -> AudioListener Spam

Hey, I am encountering a problem.

I am in a 2D environement!

This is the scenario: If a player reaches the goal he is able to choose what he wants to do next. One option is to repeat the level. Therefore there is a button which will just load the SAME scene again.

If he retrys the level now and draws a line there is a warning:

The 3D camera no longer exists...if you have changed scenes, ensure that SetCamera3D is called in order to set it up.

Therfore I have a script which says that the camera should not be destroyed on load.

The game pretty much works again and the error above will not appear anymore BUT I then have 2 (3,4,5 depending on how many times I reloaded the level) Aadio listeners in the scene and get warnings spammed which probably affects the games performance because the more I retry the level the more laggier it gets.

If you need any further information be sure to leave a comment!

If you have a solution or suggestion it is really appreciated.

Kindly regards, René

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
0

Answer by screenname_taken · Dec 07, 2014 at 10:12 PM

Is your listener in the singleton object? (an object that you save and don't destroy on level reset). If yes, then you should have an if check to see if it's already alive. If it is, kill 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 Zybrion · Dec 07, 2014 at 10:58 PM 0
Share

Upon further investigation of the problem I realised that the real problem is that the Draw Calls double if I keep the old camera on load (obviously -.-) and therefore have get performance problems.

The reason I need the "DontDestroyOnLoad" for the camera is this error:

The 3D camera no longer exists...if you have changed scenes, ensure that SetCamera3D is called in order to set it up. UnityEngine.Debug:LogError(Object) Vectrosity.VectorLine:LogError(String) Vectrosity.VectorLine:Line3DDiscrete(Int32, Int32, Matrix4x4, Boolean) Vectrosity.VectorLine:Draw() LineObject:UpdateLine() (at Assets/Draw Shapes for 2D Physic Game/Scripts/LineObject.cs:49) LineObject:Update() (at Assets/Draw Shapes for 2D Physic Game/Scripts/LineObject.cs:36)

which I do not know how to solve other than not to destroy the camera on load.

Note: I am using a drawing asset which has vectrosity included(?)

Your suggestion is good but would not solve the problem at the roots. So If you have any idea on how to solve this I would be very greatful.

avatar image
0

Answer by boazunity · Sep 03, 2016 at 01:31 PM

you need to use this line...

 void Start () {
     VectorLine.SetCamera(Camera.main);
          // or
             VectorLine.SetCamera3D(Camera.main);
        }
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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Scene loads weird 0 Answers

Scene could not be loaded even though it is in build settings 0 Answers

adding and removing objects (cameras) from other scenes than the one currently being played in 0 Answers

,Enums not being passed between scripts properly 1 Answer

Why is OnLevelWasLoaded () called twice and why are my variable's values different in each call?,How do I use a variable right after scene change? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges