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
-
Drag unit prefab into scene
-
Drag it back into Prefab Folder and choose Prefab Variant
-
Rename it
UnitSpawner (This is the one to add the UnitSpawnerPreview to as it is differant for each building.) -
Drag unitspawner prefab into scene
-
Drag it back into Prefab Folder and choose Prefab Variant
-
Rename it
-
Take both unit and unitSpawner out of scene here.
1 more thing is its Projectile
-
Drag Projectile into scene
-
Drag it back into Prefab Folder and choose Prefab Variant
-
Rename it
-
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
- Double click to open prefab UnitSpawner (the new one)
- Drag in the new UnitSpawnerPreview (which is currently empty)
- SO i had to unpack completly after draggin it in.
- Then changed to model (Building01)
- Adjust MinimapIcon
- Adjust UnitSpawningCanvas
- Adjust Health Bar Canvas (Turn off when done)
Now for the parent object settings to change. - BoxCollier first adjust as needed.
- Copy values from Box Collider to Nav Mesh Obstacle component
- Check helath for building
- Check for Building Preview
- Create empty object for AimAtPoint
- Drag into parent!
- Drag in model as Color Renderers
- 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