Preview Colors Doesn't Change

Preview colors never change, even I have removed BoxColliders from these Preview-Prefabs. I also have checked GitLab commits of this section. I think that I may have a problem with my inspector settings. Could you help me ?

Hi there,
Are you able to place the buildings, but the colour just isn’t changing? Or the game is not detecting any places that it is allowed to place the buildings?

Basically is the problem with the colour changing or the problem with the raycast/collider detection.

I couldn’t place buildings and couldn’t see color changes either. It just seems red.

Okay, so probably the problem is with building placement. This is handled by the building button script, but the problem could also be in the scene.

In BuildingButton.cs can you place a couple debug.log statements to see what is going? In UpdateBuildingPreview() put one after the Raycast statement to see if you are hitting the floor.

In RTSPlayer.s in CanPlaceBuilding() put the debug statements in the physics and distance checks to check the results of those.

Otherwise, do you have any errors in the console? In the scene, does your floor have the correct layer tag? Does your unit selection handler DragBox have a graphics raycaster that could be blocking the raycast?

Let me know what you find out.

In UpdateBuildingPreview(), my Debug statement indicating that Raycast is hitting the floor when I’m dragging my Building preview outside of the floor.
In CanPlaceBuilding(), in that situation when I drag previews inside of the base. Building preview collided with Unit base and it has returned True. Otherwise, it just returns false.

player = NetworkClient.connection.identity.GetComponent();

Also, these NullReference errors points me out to these “player” defining lines in the Update methods.

Hi There,
Can you check if It’s GetComponent() that is coming back null, or if it’s the NetworkClient.connection?
The first is expected for a couple frames, while the latter is a game breaking bug.

Privacy & Terms