Update unit price custom function

Update unit price custom function

Can I update a Unit price in product based a on custom function calculation, I cant seem to update the field through a custom function.