Still no new unit

Hello
Below is a long list of the steps I followed and tripled checked more than once. I do not get errors to help me trace the root cause for this.

I am unable to Instantiate my new unit (building01 model) by using the new button I added.

Please help an old guy out.

Here is the list I followed: (It’s long and numbered) please take a moment

While on Scene_Map_xx in Hierarchy
Unit

  1. Drag unit prefab into scene

  2. Drag it back into Prefab Folder and choose Prefab Variant

  3. Rename it
    UnitSpawner (This is the one to add the UnitSpawnerPreview to as it is differant for each building.)

  4. Drag unitspawner prefab into scene

  5. Drag it back into Prefab Folder and choose Prefab Variant

  6. Rename it

  7. Take both unit and unitSpawner out of scene here.

    1 more thing is its Projectile

  8. Drag Projectile into scene

  9. Drag it back into Prefab Folder and choose Prefab Variant

  10. Rename it

  11. Take Projectile out of scene

Here is where i lost track – the UnitSpawnerPreview
and as stated above it is required as a child to the UnitSpawner Prefab.

At this point we haed back to Menu Scene to update Network Manager
In the Registered Spawner Prefabs
update as needed for the network
we need a Unit, Projectile, and a UnitSpawner in there (for each unit type)

Back to Scene_Map_01 now
Look in BuildsDisplay for buttons
duplicate a button and set the Building Spawner To new unit

Next Player Prefab needs to know as well
I notice this is the second place we drag in a new UnitSpawner under Buildings on Player prefab.

Now thats the tendious stuff out of the way now to customize the new units!

first up [Unit], UnitSpawner, Projectile
Add a model (I choose big tank like we built with)
Scale it as needed ( I choose 2 units wide) twice my little one
Scale down miniMap icon cover new object as needed.
Adjust Health Bar (make it hidden when done editing)
Adjust Projectile SpawnPoint
Adjust AimAtPoint
Adjust SelectedHighlight (Turn off SpriteRenderer)

And finally the Parent Component Adjust settings for this parent object
Use Nav Mesh Agent to adjust Speed, etc… (use same values Stopping Distance, Radius)
keep moveing down the chain of parent to Box Collider and Adjust as needed
next up Unit Firing Script change Projectile as needed.
next up Health Change Max Health as needed.
next up Team Color Setter change Color Renderers as needed.

Tweak new Projectile’s prefab Damage to deal etc…

Now the final piece to the puzzle the [new]UnitSpawner

  1. Double click to open prefab UnitSpawner (the new one)
  2. Drag in the new UnitSpawnerPreview (which is currently empty)
  3. SO i had to unpack completly after draggin it in.
  4. Then changed to model (Building01)
  5. Adjust MinimapIcon
  6. Adjust UnitSpawningCanvas
  7. Adjust Health Bar Canvas (Turn off when done)
    Now for the parent object settings to change.
  8. BoxCollier first adjust as needed.
  9. Copy values from Box Collider to Nav Mesh Obstacle component
  10. Check helath for building
  11. Check for Building Preview
  12. Create empty object for AimAtPoint
  13. Drag into parent!
  14. Drag in model as Color Renderers
  15. Drag in the base Unit prefab for UnitSpawner Component

Ok, time to give it a try…

Failed attempt again…
Unable to spawn the new unit…???
THese are all the steps I followed.
I am not getting any errors other than the Player thing that we’ve had

I know this is a lot of notes but it is exactly as I heard it in video.

Where did i go off track?

Thanks
PS: I do get a debug.log from the mouse Down for the new Unit Building01 as the name in the console:

Thanks for any help on this

I get this debug message:
public void OnPointerDown(PointerEventData eventData)

{

    

    if (eventData.button != PointerEventData.InputButton.Left) { return; }

    if( player.GetResources() < buildingSpawner.GetPrice()) { return; }

    buildingPreviewInstance = Instantiate(buildingSpawner.GetBuildingPreview());

    buildingRendererInstance = buildingPreviewInstance.GetComponentInChildren<Renderer>();

    Debug.Log("Down click ----------------   " + buildingRendererInstance.name);

    buildingPreviewInstance.SetActive(false);

}

The console shows me Building01 as intended but not the model itself only the overlay and no error messages???

I am puzzled
Thanks for any help

Solved:

I believe I found out what I have been chasing!

After adding that button The Floor Mask was mixed.
I changed it to Floor only and now it seems to work!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms