Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved How to get rid of these warnings?

Discussion in 'Cinemachine' started by livingisgood, Oct 23, 2020.

  1. livingisgood

    livingisgood

    Joined:
    Mar 19, 2018
    Posts:
    6
    Everytime a scene with Cinemachine camera is loaded, I got these four warnings in console:

    The referenced script (Unknown) on this Behaviour is missing!
    The referenced script (Unknown) on this Behaviour is missing!
    The referenced script on this Behaviour (Game Object 'cm') is missing!
    The referenced script on this Behaviour (Game Object 'cm') is missing!

    There is no GameObject 'cm' in my scene's hierarchy, but the name 'cm' makes me think it might
    has something to do with the Cinemachine.

    It seems everything is working as expected, but still I want to know what might cause these warnings and
    how can I get rid of them.

    By the way, my project does not import cinemachine through the PackageManager, I just put it's source code
    into the assets folder. I did this a few days a ago, before that there are no warnings like that. I do not know if
    there is any connection between this.

    the unity version is 2019.3.14f1. Cinemachine is 2.6.0
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,153
    It's hard to know what the problem is. It would appear to be an issue with metafile GUIDs that may have gotten messed up when you embedded Cinemachine into your project. If you delete the embedded asset and use the package manager version again, do the warnings go away?
     
  3. livingisgood

    livingisgood

    Joined:
    Mar 19, 2018
    Posts:
    6
    Thanks for the reply!
    I tried as you said, delete the asset, use the package manager again, and the warnings are gone.
    But for some reason I wish I could still use the embedded version, because some features in my project rely on some (though very little) modification on Cinemachine's source code.
     
  4. livingisgood

    livingisgood

    Joined:
    Mar 19, 2018
    Posts:
    6
    May I ask is there a recommended way to use the Cinemachines code directly?
    what I tried before is a simple copy & paste : I installed the package from the upm, copy everything I need into the asset folder, and uninstall the package.
    Besides the warning I mentioned above, I found another issue caused by this. the noise presets are broken. they are assets created from the script NoiseSettings, but I cannot assign the script back to fix them.
    I thought I might not do it right, maybe some dependencies are got messed up.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,153
    Yes, your method of embedding the asset will produce metafile problems. Try this sequence instead:
    First uninstall CM from the package manager, then find CM in your package cache and copy it into your assets.

    However, having CM embedded will make it difficult for you to upgrade it. What exactly are the local mods? Maybe there's a way to get what you need without them.
     
    livingisgood likes this.
  6. livingisgood

    livingisgood

    Joined:
    Mar 19, 2018
    Posts:
    6
    Thanks a lot for your help!
    The mod is for implementing a simple camera shaking feature.
    I have read the documents, found that there is a impulse module just for this kind of purpose. So first time I used the impulse system to do the shake. No mod involved at all. However, the artist in my work group was not satisfied with the result. The signal asset is editable, but he seems not so comfortable with those args (add component for a property, tweak the frequency and amplitude, etc). He wants to adjust the shake effect via a animator, key-frame the position and rotation of the camera so he can fully control the shaking and find what kind of shake is he really wants.
    I insisted we use the impulse-system, for it is a recommended way to do camera shaking and we can create and test out a right signal asset we want. There is not limitation for customized need.So we began our testing with a empty signal. To our surprise (at first), a empty signal could still cause a obvious shaking in the camera. I called GenerateImpulse() in a CinemachineImpulseSource component attached to a game object in the scene. Although the function takes no arguments, the system takes the source position into account when doing the calculation, I thought this might be the reason we saw a shaking caused by a empty signal.
    So I think the problem is the impulse system provides a powerful, realistic way to stimulate physic shaking, but our artist wants a simple but fully controlled shaking animation.
    In case anybody wants to know, the mod is something like this:
    in cinemachinebrain we maintain a list of 'VirtualCameraAnimation', which is a simple mono-class wrapped it's tranform with some simple setting.
    in the function 'PushStateToUnityCamera' when all origin calculation for the cameraState are done, we add all the position of the tracked 'VirtualCameraAnimation' as a final position-offset, multiply all the rotation of them as the final rotation offset as well. By this method if we key-frame a transform attached with a 'VirtualCameraAnimation' component and add it to the brain, we can do a old-fashion camera shake.
     
    Last edited: Nov 2, 2020
  7. livingisgood

    livingisgood

    Joined:
    Mar 19, 2018
    Posts:
    6
    By the way, I am open to any advise on how to use the impulse system correctly. I do prefer using the Cinemachine's origin version to get things right than modify it.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,153
    Thanks for that description. I'm not sure I fully understand your issues, but I'll have a look to see what I can find with empty signals.

    We understand that the impulse interface is a little complex, and sometimes you just want something simple. There are ways to do that without modifying the Cinemachine code.

    For example, after the CinemachineBrain sets the camera position, a CinemachineCore.CameraUpdatedEvent is fired. You can have a separate behaviour that listens for this and adds the shake to the Camera's transform at that time.

    See https://docs.unity3d.com/Packages/c...inemachine_CinemachineCore_CameraUpdatedEvent
     
    Last edited: Nov 2, 2020
    livingisgood likes this.