Search Unity

How do I access cinemachine from a dependency?

Discussion in 'Cinemachine' started by cloverme, Dec 18, 2020.

  1. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    197
    I have Cinemachine installed (and working) in my main project solution. There's another asset that I use which is dependency. Adding "using cinemachine" produces errors, Unity acts like it can't find the reference. Trying to add the dll for it through Visual Studio doesn't work either. So if you have a dependent project as part of your main project, how do you add a reference to Cinemachine?

    "Assembly-CSharp is my Unity Project", the underlying AwesomeTechnologies.VegetationStudioPro.Runtime" project is where I need to reference Cinemachine.





    Again, if I add "using cinemachine" to my core project files, it works fine and Cinemachine is installed correctly in my main project and works correctly. I just need a way to try to reference Cinemachine from the main project.

    Adding
    Code (CSharp):
    1.     <Reference Include="Cinemachine">
    2.       <HintPath>Library\ScriptAssemblies\Cinemachine.dll</HintPath>
    3.     </Reference>
    4.     <Reference Include="com.unity.cinemachine.editor">
    5.       <HintPath>Library\ScriptAssemblies\com.unity.cinemachine.editor.dll</HintPath>
    6.     </Reference>
    to the csproj file for AwesomeTechnologies.VegetationStudioPro.Runtime doesn't work. Also, Visual Studio intellisense will offer to add the reference to the dll for Cinemachine for me, but if I do either of those two options, I get this:


    Code (CSharp):
    1. Assets\AwesomeTechnologies\VegetationStudioPro\Runtime\VegetationSystemPro\VegetationSystemPro.cs(61,16): error CS0246: The type or namespace name 'CinemachineBrain' could not be found (are you missing a using directive or an assembly reference?)
    2.  
    3. Some scripts have compilation errors which may prevent obsolete API usages to get updated. Obsolete API updating will continue automatically after these errors get fixed.
    4.  
    I figure there's some c# voodoo I need to do, but not sure what it is...
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    To make a package depend on a second package, find the first package's asmdef file in the project explorer (here I'm showing it for Cinemachine, but you want to do this for your other package):

    upload_2020-12-19_11-0-6.png

    Click on it, and in the inspector, add a reference to Cinemachine:

    upload_2020-12-19_11-0-51.png