OndrejNepozitek / Edgar-Unity

Unity Procedural Level Generator
https://ondrejnepozitek.github.io/Edgar-Unity/docs/introduction
MIT License
817 stars 70 forks source link

can not add prefab to collidable tilemap #31

Closed stickylabdev closed 4 years ago

stickylabdev commented 4 years ago

just it , or i still dont understand

OndrejNepozitek commented 4 years ago

Hey, can you please provide some details of your problem?

stickylabdev commented 4 years ago

im trying to add spike game object to the tilemap named collidable ,,,,,,,,,,,but when i generate the map ,, that spike does not appear

OndrejNepozitek commented 4 years ago

Tilemaps are meant only for tiles. But you want to spawn a GameObject, right?

Not long ago, someone asked me how to include a GameObject prefab in a room template and then spawn it inside the room after the map is generated. Is that what you need?

stickylabdev commented 4 years ago

i think i can use brush tile or what is that called ,,,,,,,,,,,,,

stickylabdev commented 4 years ago

someting like game object tile ,, so , i dont use default brush but gameobject brush

stickylabdev commented 4 years ago

and i want to ask other things ,, how to remove auto add rigi body and composite colider ? imean when i generate , i dont want to add rigibody and composite clider

OndrejNepozitek commented 4 years ago

You can implement your own TilemapLayersHandler (as a ScriptableObject) and assign it to the PayloadInitilaizer in the DungeonGenerator to achieve that. A brief description can be found here.

By default, this TilemapLayersHandler is used. I would suggest to copy the source of this class and simply remove the code that adds RigidBody and CompositeCollider. Then create an instance of the ScriptableObject and assign it to the PayloadInitializer.

stickylabdev commented 4 years ago

extremely super cool ,thanks :D

stickylabdev commented 4 years ago

i just want to make sure ,, we can not use this or there is some way to add this ?

image

because i want to add start and finish feature ,,i mean ,, auto add spawn point when i generate the map

OndrejNepozitek commented 4 years ago

I haven't used the GameObject Brush yet, so unfortunately I don't know how exactly that works and whether it can be used in the plugin. But I think that you should be able to use a solution that I prepared for another user of the plugin. The idea is that you can add GameObjects to RoomTemplates and they are then instantiated after the level is generated.

Here is the description of how to do that:

"I created a simple pipeline task that will spawn game objects for you. You can find it here - https://gist.github.com/OndrejNepozitek/0316e90ebea833bd55576762c49ad4de

Usage: 1) Create instance of the task - Right click -> Create -> Dungeon generator -> Custom Tasks -> Spawn GameObjects 2) Add the task to the generator pipeline (see https://ondrejnepozitek.github.io/ProceduralLevelGenerator-Unity/docs/generatorSetup) after the generator itself 3) Open your room template and inside it create an empty "GameObjects" GameObject (the name is important - the task needs it to work) 4) Add GameObjects you would like to spawn as children of the "GameObjects" 5) Now after you generate your level, the pipeline task will go through all the spawned rooms, look for "GameObjects" GameObject and then instantiate all its children (and correct their positions)"

So you would add your "Start" and "Finish" game objects to the corresponding room templates and the pipeline task should spawn them after your level is generated.

I want to include this functionality in the future releases of the plugin itself.

stickylabdev commented 4 years ago

thanks a lot 🍡

stickylabdev commented 4 years ago

extremely cool ,it works :D