Forum rules - please read before posting.

Inspector on Edited _Camera Class loses references.

I add an object reference to the _Camera class to store a reference to a Cinemachine virtual camera script.

I then disabled/deleted the _Camera editor inspector script, so as to reveal my newly added variable.

I drag the appropriate object into the inspector to assign it to the field in edit mode.  Everything is fine.  I run the game. Everything is still fine.  I leave playmode, and after a moment, the object field is empty in the inspector, the reference is lost.

I've tried removing all Cinemachine references and testing with a normal Transform reference. The problem persists.

Is there something about how AC stores/saves data that could cause this?
Thanks!

Comments

  • You're just editing the _Camera MonoBehaviour script?  If you're talking about Editor field serialization, and not the actual AC save system, no, shouldn't be any issues like that.  What was the actual code change?

    On a side note: the _Camera component is designed to be sub-classed, so you can make a new class that has any changes you need, without having to amend AC's core scripts, and still have it talk to AC's camera system.
  • edited October 2017
    Don't get upset by me asking this... but is your variable public or marked with the attribute [SerializeField]? Also, some types can't be serialized by Unity, like nested lists or Dictionaries, so their data will be lost after exiting playmode... are you certain the type you are using is serializable? (I've used Cinemachine in code too, but I always find the cameras dynamically so I've never really needed it to be serialized). Anyway, it would be nice to see the line of code in question just to be sure...
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.