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

Can't add TransformObjectToWorld component

Discussion in 'Project Tiny' started by Eulenmensch, May 6, 2019.

  1. Eulenmensch

    Eulenmensch

    Joined:
    Mar 10, 2018
    Posts:
    19
    Hi there!
    I'm trying to add a TransformObjectToWorld component to an entitiy. I have tried
    • the editor => the component isn't listed
    • over code => I get an error that the component is already there
    When I try to access the component though it throws another error:

    ut.World.getComponentData(): Entity "Sprite"[141:1] does not have an instance of component ut.Core2D.TransformObjectToWorld (Component ID 48).


    This seems to either be a bug, outdated/deprecated functionality or a user error on my end but I can't quite tell ^^
     
  2. Zionisias

    Zionisias

    Joined:
    Apr 23, 2019
    Posts:
    40
    The documentation for this component is:
    "The UpdateWorldTransformSystem system adds and updates this component, which
    provides direct access to the cached Object to World space transform. This
    component is readable and writeable.
    "

    It seems that this component is only meant to be used internally by Unity Tiny itself. What is your usecase exactly for why you would like to add this component?
     
  3. Eulenmensch

    Eulenmensch

    Joined:
    Mar 10, 2018
    Posts:
    19
    Yes, I might have understood it incorrectly maybe. My understanding is that it is automatically added when a script tries to access it. This is not how it works in reality though, so I'm trying to add it but that also doesn't seem to work.
    The reason I want to access it is to set the coordinates of a child entity to those of its parent.
     
  4. Zionisias

    Zionisias

    Joined:
    Apr 23, 2019
    Posts:
    40
    I don't think that you are looking for this component, as far as I can see, it's only meant to be read, and not meant to be used to set an entity's position. If you simply want the child to have the same position as its parent, you could probably just set it via the ut.Core2D.TransformLocalPosition on the child-entity. Setting the ".position" value of this component to new Vector3(0, 0, 0) would position the child-entity at the location of its parent.
     
    Eulenmensch likes this.
  5. Eulenmensch

    Eulenmensch

    Joined:
    Mar 10, 2018
    Posts:
    19
    Oh... of course ^^ thank you so much! I still don't understand how I would go about reading the component but it seems like I don't need to after all.
     
    Zionisias likes this.