Forum rules - please read before posting.

Problem with GameCamera2DDrag when changing scene

Since the AC update1.7X/1.75, the script in game 2Dcamera error appear when changing scene and I can`t drag it anymore, it was worked before any suggestion please.

(unity version 2021.3.4 & Last AC)


MissingReferenceException: The object of type 'GameCamera2DDrag' 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.Component.GetComponent[T] () (at :0)
AC._Camera.get_Camera () (at Assets/AdventureCreator/Scripts/Camera/_Camera.cs:295)
AC.GameCamera2DDrag._Update () (at Assets/AdventureCreator/Scripts/Camera/GameCamera2DDrag.cs:120)

AC.StateHandler.Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:278)

Comments

  • Welcome to the community, @Aru.

    Can you share details on how your camera is set up? Is it part of the scene you're entering, or the one you're leaving?

    Any screenshots you can share of where it is in the Hierarchy will help me understand the situation.

  • Thanks Chris
    Yes, Its a part of each scene the main Camera I used in Default cam, here is my setup and the error I got after scene change, when I go in to the new scene I cant move the cam anymore.

    https://imgur.com/Uxz4g5F
    https://imgur.com/xdOS55f

  • Recreated, thanks for the details.

    To fix it, open up AC's GameCamera2DDrag script, and find the OnDisable function around line 111. Inside that, replace:

    base.OnEnable ();
    

    with:

    base.OnDisable ();
    
  • Excellent! It`s work again now thanks Chris

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.