News Forums RAIN General Discussion and Troubleshooting Getting Entity from an outside script

This topic contains 17 replies, has 3 voices, and was last updated by  daedalus29 1 year, 5 months ago.

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #36766

    daedalus29
    Participant

    Hello everyone! I’m new to RAIN AI, and I understand just a few thing about scripting. I Tryed to change a Entity Rig state via another script on the player character as you wanted to, but I cant use your code to do it, since it give me an error “EntityRig Could not be found”.

    My character tree is like this:

    Player> Entity> Entity Rig script

    So I wrote:

    EntityRig tRig = Entity.GetComponentInChildren<EntityRig>();
    tRig.Entity.IsActive = false;

    Later, I changed it to “EntityRig tRig = this.GetComponentInChildren<EntityRig>();
    tRig.Entity.IsActive = false;

    But It couldnt find out neither.

    Any suggestion?

    #36770

    prime
    Keymaster

    This is from within a MonoBehaviour? Which is attached to what object? The general approach should be fine.

    #36771

    daedalus29
    Participant

    Hello!

    I managed to make it work in a monobehaviour by writing:

    RAIN.Entities.EntityRig tRig = GetComponentInChildren<RAIN.Entities.EntityRig>();
    			{
    				tRig.Entity.GetAspect("Target").IsActive = true;
    					}

    But I think i’ll have some more questions in the next hours

Viewing 3 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic.