I you want to collect for ID, rather than for observing its behavior, I think this depends a lot on which species, and which stage they are in when collected. If the maturing process has already started, it might just continue no matter what, so you can take a sample and hopefully see it to completion (but it might also not like the disturbance and turn into a hard crust…).
You mention Lycogala and Trichia, so I would imagine that they’re already somehow recognizable and in the process of fruiting. If their location is too far or difficult to access to observe their progress in situ, it’s worth taking a piece of substrate with a few fruiting bodies attached to it, and see how they develop.
It is probably a good idea to keep the conditions (temperature, humidity, light) as close as possible to those of its original location. But I would also be careful about too much humidity, which could cause fungal mold to grow on slime mold…
Also, no need to feed the fruiting body.
I’m lucky enough to have access to close-by habitats where I can easily come back to check on maturing slime molds after I find early stages. But I’ve occasionally brought some home to see the maturation process.
For example, I had managed to take home some immature fruiting of Stemonitis (looking like a cluster of yellowish globules), which properly finished maturing into the classic chocolate tube within a few hours.
With intention to ID, I had also collected a Physarale plasmodium from under a log, and similar to others’ experience, had been able to keep it for several months in a small plastic container with moist paper towel as a substrate, feeding it oats every now and then. You have to keep an eye on mites and actual mold, and if they get out of control, you might need to transfer the slime mold to a new container for a fresh new start.
Although I kept it for a while, it never produced any fruiting so I was not able to give it a precise ID… But it’s still fun to observe! :-)
For many species, the precise conditions triggering a change from plasmodium to fruiting body are unknown, making it tricky to get a particular unknown plasmodium develop into something identifiable.
I remember having several conversations about this with @sarahlloyd, who contributed a lot to improving my understanding of myxomycetes, and to whom I’m extremely thankful!
This particular conversation might be the most relevant, but I think there are a few more. :-)