playMaker

Author Topic: Can't set Layer on 'FSM Draw Line' for Camera Culling Mask [SOLVED]  (Read 627 times)

curb47

  • Sr. Member
  • ****
  • Posts: 256
Hi there,

I've got a problem.

I've introduced a 3-camera setup for my game; Background (perspective), Gameplay (orthographic) and Foreground (perspective).

All the action happens on Z=0, and all the gameplay objects have their layer set to Gameplay, including prefabs, to be seen only by the Gameplay orthographic camera.

For my spaceship laser gun, I have used a raycast setup, with pooled prefab lasers using the Draw Line FSM.

The problem is, when the Draw Line FSM is created from the pooled lasers, the Layer for the Draw Line is set to Default, even though the FSM that creates them is set to Gameplay, and I can't see any way to set the layer for the Draw Line FSM prior to spawning. Basically, I need the Draw Line FSM layer to be set to Gameplay.

Here are some screen grabs all taken from the same moment whilst the game is paused.

1. In the Game window, here is the spaceship with the lasers firing... but you can't see them.


2. This is the same moment but image is from the Scene window, where you can see the lasers.


3. In the Hierarchy window you can see the leftBeam(clone), which is the pooled object that has the Draw Line action on the attached 'FIRE' FSM. You can see it's Layer is set to Gameplay.


4. Further down the Hierarchy you can see the FSM draw line () object, which is created by the leftBeam(clone) upon spawn, and you can see the Layer is set to Default. Which is the root of the problem.


5. With the game still paused, I select all the FSM draw line() objects, and change the Layer to Gameplay.


6. And back in the Game window, is the result of changing the FSM draw line Layer to Gameplay... you can see the lasers.


I've tried using the Set Layer action, but it doesn't do anything.

Please, can somebody help me out with this?

Thanks.

J.


 

« Last Edit: September 25, 2020, 09:16:52 AM by curb47 »

curb47

  • Sr. Member
  • ****
  • Posts: 256
Re: Can't set Layer on 'FSM Draw Line' for Camera Culling Mask [SOLVED]
« Reply #1 on: September 25, 2020, 09:20:07 AM »
Okay, I figured it out.
In the Draw Line action, at the bottom of the action parameters there's a Store Game Object option for the Draw Line, so set this, eg laserline, then add a Set Layer action to the state, and there set the object to the object variable (laserline) and set the layer.

Simple really.