you go commit a crime, you told judge you are ignorant of the
crime, do you think the judge will acquit you based on your
ignorance?
the judge will tell you, ignorance of the law cannot be used as an
excuse or is no excuse. you will still be punished.
as for kamma, whether good or bad, you will inherit them when you
go to the next world. the only kamma that are not good or bad are
neutral kamma, like sleeping, sitting and standing.
if you happen to step onto the ant because you are not aware, it is
considered no kamma cos the intention is not there.