Search Unity

Unity 2018.3, Probuilder 4 scripting

Discussion in 'World Building' started by nilserik, Feb 13, 2019.

  1. nilserik

    nilserik

    Joined:
    Oct 28, 2016
    Posts:
    4
    Hello, I'm having problems using the UnityEngine.Probuilder namespace after starting an empty project, using the package manager to download probuilder 4 and copying the following code into a script in the Assets folder.

    Code (CSharp):
    1. ProBuilderMesh quad = ProBuilderMesh.Create(
    2.     new Vector3[] {
    3.         new Vector3(0f, 0f, 0f),
    4.         new Vector3(1f, 0f, 0f),
    5.         new Vector3(0f, 1f, 0f),
    6.         new Vector3(1f, 1f, 0f)
    7.     },
    8.     new Face[] { new Face(new int[] { 0, 1, 2, 1, 3, 2 } )
    9. } );
    The problem is that it doesnt find the probuilder namespace :(

    The code is taken from this page of the docs https://docs.unity3d.com/Packages/com.unity.probuilder@4.0/manual/api.html.

    I can clearly see the probuilder package in the packages folder of my project. What am I doing wrong?

    Thank you for your consideration and any help you might provide :)
     
    Last edited: Feb 13, 2019
  2. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
  3. nilserik

    nilserik

    Joined:
    Oct 28, 2016
    Posts:
    4
    Thank you karl, I figured it out yesterday.

    I had to "manually" edit the Unity.Probuilder asmdef to set the autoreferenced value to true. I hope this will be changed in the future to be set to true by default.
    By manually editing it I meant from outside of Unity with a text editor.
     
  4. nilserik

    nilserik

    Joined:
    Oct 28, 2016
    Posts:
    4
    I tried doing as you recommended by creating an asmdef for my project which I put in the root of my scripts folder, which works! Although I also have scripts in a library folder and I also had to create an asmdef there and reference the main one to the second one.