Interact with individual tiles


#1

Hi again,

Is it possible to interact with tiles in a tileEd Map:

  • I created a prefab “wall” with meshrenderer
  • My camera has a box collider trigger
  • I would like that when the camera box collider touches a tile, it would disable its meshrenderer

I tried as below using TileEdTileTag +othercollider but it says that other collider doesnt have a mesh renderer. Although I used a debug to check what the other collider is, and it is the wall

If someone could let me know what I should correct here? Thks a lot.


(Leslie Young) #2

I moved this since it is a Blox question. TileEd simply places objects to a scene and it would be same as if you placed that wall yourself by dragging it into the scene.

Can I see the exact way you try and disable the rendered? I see the enable = false block but if that is what it looked like while inside the event then is wrong since it refers to -self-, which is the camera.


#3

Hi Leslie,

1/ 1st screenshot is my code
2/ 2nd shows that the tile is recognized as othercollider + error message Im getting now
3/ The tile itself

Error in Block [GameObject:OnTriggerStay(…):Flow/IF]
Field tag defined on type TileEd.TileEdTile is not a field on the target object which is of type UnityEngine.Transform.
Parameter name: obj
UnityEngine.Debug:LogErrorFormat(Object, String, Object[])
BloxEngine.BloxBlock:LogError(String, Exception) (at D:/DevUnity/_SOURCE/Blox/BloxEngine/Blox/BloxBlock.cs:602)
BloxEngine.IF_Block:RunBlock() (at D:/DevUnity/_SOURCE/Blox/BloxEngine/Blox/Blocks/Flow/IF_Block.cs:30)
BloxEngine.BloxBlock:Run() (at D:/DevUnity/_SOURCE/Blox/BloxEngine/Blox/BloxBlock.cs:484)
BloxEngine.BloxEvent:Run() (at D:/DevUnity/_SOURCE/Blox/BloxEngine/Blox/BloxEvent.cs:172)
BloxEngine.BloxEventHandler:RunEvent(BloxEvent, BloxEventArg[]) (at D:/DevUnity/_SOURCE/Blox/BloxEngine/Blox/EventHandlers/BloxEventHandler.cs:29)
BloxEngine.BloxEventHandler:RunEvents(List`1, BloxEventArg[]) (at D:/DevUnity/_SOURCE/Blox/BloxEngine/Blox/EventHandlers/BloxEventHandler.cs:18)
BloxEngine.Trigger3D_nfo_BloxEventHandler:OnTriggerStay(Collider) (at D:/DevUnity/_SOURCE/Blox/BloxEngine/Blox/EventHandlers/Trigger3D_nfo_BloxEventHandler.cs:30)


(Leslie Young) #4

Which of the “tag” Blocks are you using? You will see that it exist for Transform, GameObject, etc. You want to use the Block from the UnityEngine > Collider group of Blocks since you are passing a Collider as context.


#5

Omg, I feel so dumb now… Yes that was the problem.

Thks Leslie, and sorry the useless question. Cheers,


(Leslie Young) #6

No problem. As a non-coder you should not have to think of these things. Just keep note of the Context and the Types the info panel talks about and try to match these types up as far as possible.

A few things around passing GameObject/Component types are automated as far possible. So you can try this shortcut, sometimes. Say for example the context wants an Animator then you could pass it a GameObject.

In fact, this passing a Collider when a Transform context was expected should have worked too. I’ll make a note to have a look at why it failed in this case.