Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Is it possible to use Shape2D in C#?

Discussion in 'Project Tiny' started by Ferran_SP, Jun 17, 2019.

  1. Ferran_SP

    Ferran_SP

    Joined:
    Jul 9, 2018
    Posts:
    27
    Hi,

    I've added the Unity.Tiny.Shape2D assembly definition reference in my project.
    I expected this would allow me to add a Shape2DRenderer component to my entities, but turns out in the Shape2D.cs file this component is flagged with the HideInInspector attribute, so I can't do that visually.
    So I thought I would create a custom component, and have it inherit from Shape2DRenderer. But it won't allow me to inherit from Shape2DRenderer:

    Assets\Samples\Project Tiny\0.15.3-preview\Spawn and Destroy\Components\TestShapeComponent.cs(9,36): error CS0527: Type 'Shape2DRenderer' in interface list is not an interface


    Why's this?

    I'll try to add the component manually from code to an entity, but I'd like to know why I can't do like above.

    Thanks!
     
  2. JJJohan

    JJJohan

    Joined:
    Mar 18, 2016
    Posts:
    214
    If they've directly ported the implementation from the TypeScript version then it simply isn't visible in the editor but can be added programmatically.

    I've had a play with it but it shape rendering doesn't appear to work correctly in the current version. See my experience with Shape2DRenderer in this post.
     
    Ferran_SP likes this.